Class PHRUTS_Properties


A set of persistent properties, which can be loaded from a properties file.

  • author: John WILDENAUER <> (PHP4 port of Struts)
  • author: Olivier HENRY <> (PHP5 port of Struts)
  • version: $Id: PHRUTS_Properties.php,v 1.3 2008/05/24 13:32:44 ohenry Exp $
  • copyright: Copyright PHruts 2008
  • todo: Manage UTF8 encodage.

Located in /util/PHRUTS_Properties.php (line 33)

Variable Summary
array $properties
Method Summary
string getProperty (string $key)
array keySet ()
void load (string $file)
void setProperty (string $key, string $value)
void size ()
array $properties = array() (line 37)
  • access: protected
getProperty (line 237)

Gets the property with the specified key in the property list.

  • return: The value for the given key or null if not found
  • access: public
string getProperty (string $key)
  • string $key: The key for this property
keySet (line 227)

Returns the keys of properties

  • access: public
array keySet ()
load (line 81)

Reads a property list from a properties file.

The stream should have the following format:

An empty line or a line starting with # or ! is ignored. A backslash (\) at the end of the line makes the line continueing on the next line (but make sure there is no whitespace after the backslash). Otherwise, each line describes a key/value pair.

The chars up to the first whitespace, "=" or ":" are the key. You can include this caracters in the key, if you precede them with a backslash (\). The key is followed by optional whitespaces, optionally one = or :, and optionally some more whitespaces. The rest of the line is the resource belonging to the key.

Escape sequences \t, \n, \r, \\, \", \', \!, \#, \ (a space) are detected and converted to the corresponding single character.

 # This is a comment
 key     = value
 k\:5      \ a string starting with space and ending with newline\n
 # This is a multiline specification; note that the value contains
 # no white space.
 weekdays: Sunday,Monday,Tuesday,Wednesday,\\

  • throws: PHRUTS_IOException
  • access: public
void load (string $file)
  • string $file: The properties file
setProperty (line 45)

Adds the given key/value pair to this properties.

  • access: public
void setProperty (string $key, string $value)
  • string $key
  • string $value
size (line 218)

Returns the number of properties

  • access: public
void size ()

Documentation generated on Sat, 31 May 2008 15:46:27 +0200 by phpDocumentor 1.4.1