Properties

Convenience class for reading and writing property files.

FIXME

   - Add support for arrays (separated by ',')
package

phing.system.util

version

$Id: cb8e49260c93416aaf25ef9f345c26fa6d300d61 $

Methods

Constructor

__construct(array $properties = null) 

Arguments

$properties

array

Appends a value to a property if it already exists with a delimiter

append(string $key, mixed $value, string $delimiter = ',') 

If the property does not, it just adds it.

Arguments

$key

string

$value

mixed

$delimiter

string

Whether loaded properties array contains specified property name.

containsKey( $key) : boolean

Arguments

$key

Response

boolean

Get value for specified property.

get(string $prop) : mixed

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

see \Properties::getProperty()

Arguments

$prop

string

The property name (key).

Response

mixed

Returns copy of internal properties hash.

getProperties() : array

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

Response

array

Get value for specified property.

getProperty(string $prop) : mixed

This is the same as get() method.

see \Properties::get()

Arguments

$prop

string

The property name (key).

Response

mixed

Process values when being read in from properties file.

inVal(string $val) : mixed

does things like convert "true" => true

Arguments

$val

string

Trimmed value.

Response

mixed

The new property value (may be boolean, etc.)

Whether properties list is empty.

isEmpty() : boolean

Response

boolean

Returns properties keys.

keys() : array

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

Response

array

Load properties from a file.

load(\PhingFile $file) : void
throws
  • if unable to read file.

Arguments

$file

\PhingFile

Process values when being written out to properties file.

outVal(mixed $val) : string

does things like convert true => "true"

Arguments

$val

mixed

The property value (may be boolean, etc.)

Response

string

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

propertyNames() : array

Response

array

Set the value for a property.

put(string $key, mixed $value) : mixed

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

Arguments

$key

string

$value

mixed

Response

mixed

Set the value for a property.

setProperty(string $key, mixed $value) : mixed

Arguments

$key

string

$value

mixed

Response

mixed

Old property value or NULL if none was set.

Stores current properties to specified file.

store(\PhingFile $file = null, string $header = null) : void
throws
  • on error writing properties file.

Arguments

$file

\PhingFile

File to create/overwrite with properties.

$header

string

Header text that will be placed (within comments) at the top of properties file.

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

toString() : string

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.

Response

string

Properties

properties

properties : 

Type(s)

file

file : \PhingFile
var

Type(s)

\PhingFile