Class LoggerPropertySetter

Description

General purpose Object property setter. Clients repeatedly invokes setProperty() in order to invoke setters on the Object specified in the constructor.

Usage:

  1.  $ps new LoggerPropertySetter($anObject);
  2.  $ps->set("name""Joe");
  3.  $ps->set("age"32);
  4.  $ps->set("isMale"true);
will cause the invocations
  1.  $anObject->setName("Joe");
  2.  $anObject->setAge(32);
  3.  $anObject->setMale(true)
if such methods exist.

  • author: Marco Vassura
  • version: $Revision: 556801 $
  • since: 0.5

Located in /config/LoggerPropertySetter.php (line 47)


	
			
Method Summary
static void setPropertiesByObject (object &$obj, array $properties, string $prefix)
LoggerPropertySetter LoggerPropertySetter (object &$obj)
void activate ()
void setProperties (array $properties, string $prefix)
void setProperty (string $name, string $value)
Methods
static method setPropertiesByObject (line 76)

Set the properties of an object passed as a parameter in one go. The

  1. properties
are parsed relative to a
  1. prefix
.

static void setPropertiesByObject (object &$obj, array $properties, string $prefix)
  • object &$obj: The object to configure.
  • array $properties: An array containing keys and values.
  • string $prefix: Only keys having the specified prefix will be set.
Constructor LoggerPropertySetter (line 61)

Create a new LoggerPropertySetter for the specified Object.

This is done in prepartion for invoking setProperty() one or more times.

LoggerPropertySetter LoggerPropertySetter (object &$obj)
  • object &$obj: the object for which to set properties
activate (line 143)
void activate ()
setProperties (line 90)

Set the properites for the object that match the

  1. prefix
passed as parameter.

void setProperties (array $properties, string $prefix)
  • array $properties: An array containing keys and values.
  • string $prefix: Only keys having the specified prefix will be set.
setProperty (line 125)

Set a property on this PropertySetter's Object. If successful, this

method will invoke a setter method on the underlying Object. The setter is the one for the specified property name and the value is determined partly from the setter argument type and partly from the value specified in the call to this method.

<p>If the setter expects a String no conversion is necessary. If it expects an int, then an attempt is made to convert 'value' to an int using new Integer(value). If the setter expects a boolean, the conversion is by new Boolean(value).

void setProperty (string $name, string $value)
  • string $name: name of the property
  • string $value: String value of the property

Documentation generated by phpDocumentor 1.3.2