phing-system-util
[ class tree: phing-system-util ] [ index: phing-system-util ] [ all elements ]

Class: Properties

Source Location: /system/util/Properties.php

Class Overview


Convenience class for reading and writing property files.


Author(s):

Version:

  • $Revision: 552 $

Methods



Class Details

[line 35]
Convenience class for reading and writing property files.

FIXME

  • Add support for arrays (separated by ',')




Tags:

version:  $Revision: 552 $


[ Top ]


Class Methods


method containsKey [line 249]

boolean containsKey( $key)

Whether loaded properties array contains specified property name.



Parameters:

   $key  

[ Top ]

method get [line 202]

mixed get( string $prop)

Get value for specified property.

This function exists to provide a hashtable-like interface for properties.




Tags:



Parameters:

string   $prop   The property name (key).

[ Top ]

method getProperties [line 174]

array getProperties( )

Returns copy of internal properties hash.

Mostly for performance reasons, property hashes are often preferable to passing around objects.




[ Top ]

method getProperty [line 186]

mixed getProperty( string $prop)

Get value for specified property.

This is the same as get() method.




Tags:



Parameters:

string   $prop   The property name (key).

[ Top ]

method inVal [line 103]

mixed inVal( string $val)

Process values when being read in from properties file.

does things like convert "true" => true




Tags:

return:  The new property value (may be boolean, etc.)
access:  protected


Parameters:

string   $val   Trimmed value.

[ Top ]

method isEmpty [line 267]

boolean isEmpty( )

Whether properties list is empty.



[ Top ]

method keys [line 259]

array keys( )

Returns properties keys.

Use this for foreach() {} iterations, as this is faster than looping through property values.




[ Top ]

method load [line 46]

void load( $file)

Load properties from a file.



Tags:

throws:  IOException - if unable to read file.


Parameters:

PhingFile   $file  

[ Top ]

method outVal [line 118]

string outVal( mixed $val)

Process values when being written out to properties file.

does things like convert true => "true"




Tags:

access:  protected


Parameters:

mixed   $val   The property value (may be boolean, etc.)

[ Top ]

method parse [line 64]

array parse( string $filePath, boolean $processSections)

Replaces parse_ini_file() or better_parse_ini_file().

Saves a step since we don't have to parse and then check return value before throwing an error or setting class properties.




Tags:

return:  Properties loaded from file (no prop replacements done yet).
access:  protected


Parameters:

string   $filePath  
boolean   $processSections   Whether to honor [SectionName] sections in INI file.

[ Top ]

method propertyNames [line 241]

array propertyNames( )

Same as keys() function, returns an array of property names.



[ Top ]

method put [line 233]

void put( string $key, mixed $value)

Set the value for a property.

This function exists to provide hashtable-lie interface for properties.




Parameters:

string   $key  
mixed   $value  

[ Top ]

method setProperty [line 216]

mixed setProperty( string $key, mixed $value)

Set the value for a property.



Tags:

return:  Old property value or NULL if none was set.


Parameters:

string   $key  
mixed   $value  

[ Top ]

method store [line 151]

void store( $file, [string $header = null])

Stores current properties to specified file.



Tags:

throws:  IOException - on error writing properties file.


Parameters:

PhingFile   $file   File to create/overwrite with properties.
string   $header   Header text that will be placed (within comments) at the top of properties file.

[ Top ]

method toString [line 135]

string toString( )

Create string representation that can be written to file and would be loadable using load() method.

Essentially this function creates a string representation of properties that is ready to write back out to a properties file. This is used by store() method.




Tags:

access:  public


[ Top ]


Documentation generated on Mon, 19 Oct 2009 10:51:49 +0200 by phpDocumentor 1.4.3