TAttributeCollection implements a collection for storing attribute names and values.
Besides all functionalities provided by {@link TMap}, TAttributeCollection
allows you to get and set attribute values like getting and setting
properties. For example, the following usages are all valid for a
TAttributeCollection object:
$collection->Text='text';
echo $collection->Text;
They are equivalent to the following:
$collection->add('Text','text');
echo $collection->itemAt('Text');
Note, attribute names are case-insensitive. They are converted to lower-case
in the collection storage.
public function testHasProperty() { $collection = new TAttributeCollection(); self::assertEquals(false, $collection->hasProperty('Property')); $collection->Property = 'value'; self::assertEquals(true, $collection->hasProperty('Property')); }
/** * Returns the list of custom parameters. * Custom parameters are name-value pairs that may subsititute translation * place holders during rendering. * @return TAttributeCollection the list of custom parameters */ public function getParameters() { if ($parameters = $this->getViewState('Parameters', null)) { return $parameters; } else { $parameters = new TAttributeCollection(); $parameters->setCaseSensitive(true); $this->setViewState('Parameters', $parameters, null); return $parameters; } }