SupportLib
[ class tree: SupportLib ] [ index: SupportLib ] [ all elements ]

Class: PropertyBag

Source Location: /SupportLib/PropertyBag.php

Class Overview


An implementation of a PropertyHolder that uses an array to store name/value property pairs.


Author(s):

  • Randy L. Pearson

Version:

  • 0.2

Implements interfaces:

Methods



Class Details

[line 16]
An implementation of a PropertyHolder that uses an array to store name/value property pairs.



Tags:

author:  Randy L. Pearson
version:  0.2


[ Top ]


Class Methods


constructor __construct [line 31]

PropertyBag __construct( array $properties, array $extra)

Constructor.

This version improves over previous versions by allowing the object to be initialized by copying properties from either arrays or other PropertyHolder objects.




Tags:

access:  public


Parameters:

array   $properties   An array holding a list of valid property name/value pairs.
array   $extra   A second array of optional values that will be merged into the properties.

[ Top ]

method add [line 89]

void add( string $name, [string $value = ""])

Adds a new property to the bag.



Tags:

access:  public



Implementation of:
PropertyHolder::add()
Adds a new property to the bag.

Parameters:

string   $name   Name of the new property.
string   $value   Value of the property. (Default: "")

[ Top ]

method checkName [line 76]

none checkName( $name)

Determines if a name is valid.



Tags:

return:  Throws error if not valid.
access:  protected


Parameters:

   $name  

[ Top ]

method isValidName [line 113]

void isValidName( $name)

Tests for a valid property name.



Tags:

access:  public
since:  0.2 - Nov 6, 2006



Implementation of:
PropertyHolder::isValidName()
Tests to see if a property name is valid.

Parameters:

   $name  

[ Top ]

method names [line 103]

array names( )

Returns a list of valid property names.



Tags:

return:  An array of the current property names as strings.
access:  public



Implementation of:
PropertyHolder::names()
Returns a list of valid property names.
[ Top ]

method __get [line 51]

any __get( string $name)

Accessor function that reads a property's value.



Tags:

return:  Throws error on invalid property name.
access:  public


Parameters:

string   $name   Name of the property to be returned.

[ Top ]

method __set [line 65]

none __set( string $name, any $value)

Mutator function that updates a property's value.



Tags:

return:  Throws error on invalid property name.
access:  public


Parameters:

string   $name   Name of the property to be updated.
any   $value   The value to assign.

[ Top ]


Documentation generated on Wed, 15 Nov 2006 08:48:06 -0600 by phpDocumentor 1.3.1