## Class TAttributeCollection

Description

TAttributeCollection class

TAttributeCollection implements a collection for storing attribute names and values.

Besides all functionalities provided by 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.

- since: 3.0
- version: $Id: TAttributeCollection.php 2541 2008-10-21 15:05:13Z qiang.xue $
- author: Qiang Xue <qiang.xue@gmail.com>

Located in /Collections/TAttributeCollection.php (line 45)

    TComponent
       |
       --TMap
          |
          --TAttributeCollection

Method Summary
void add (mixed $key, mixed $value)
boolean canGetProperty (string $name)
boolean canSetProperty (string $name)
boolean contains (mixed $key)
boolean getCaseSensitive ()
boolean hasProperty (string $name)
mixed itemAt (mixed $key)
mixed remove (mixed $key)
void setCaseSensitive (boolean $value)
mixed __get (string $name)
void __set (string $name, mixed $value)
Methods
add (line 109)

Adds an item into the map.

This overrides the parent implementation by converting the key to lower case first if CaseSensitive is false.

- access: public

void add (mixed $key, mixed $value)

- mixed $key: key
- mixed $value: value

Redefinition of:

TMap::add()
  Adds an item into the map.

canGetProperty (line 155)

Determines whether a property can be read.

This method overrides parent implementation by returning true if the collection contains the named key.

- return: whether the property can be read
- access: public

boolean canGetProperty (string $name)

- string $name: the property name

Redefinition of:

TComponent::canGetProperty()
  Determines whether a property can be read.

canSetProperty (line 167)

Determines whether a property can be set.

This method overrides parent implementation by always returning true because you can always add a new value to the collection.

- return: true
- access: public

boolean canSetProperty (string $name)

- string $name: the property name

Redefinition of:

TComponent::canSetProperty()
  Determines whether a property can be set.

contains (line 131)

Returns whether the specified is in the map.

This overrides the parent implementation by converting the key to lower case first if CaseSensitive is false.

- return: whether the map contains an item with the specified key
- access: public

boolean contains (mixed $key)

- mixed $key: the key

Redefinition of:

TMap::contains()

getCaseSensitive (line 78)

- return: whether the keys are case-sensitive. Defaults to false.
- access: public

boolean getCaseSensitive ()
hasProperty (line 143)

Determines whether a property is defined.

This method overrides parent implementation by returning true if the collection contains the named key.

- return: whether the property is defined
- access: public

boolean hasProperty (string $name)

- string $name: the property name

Redefinition of:

TComponent::hasProperty()
  Determines whether a property is defined.

itemAt (line 97)

Returns the item with the specified key.

This overrides the parent implementation by converting the key to lower case first if CaseSensitive is false.

- return: the element at the offset, null if no element is found at the offset
- access: public

mixed itemAt (mixed $key)

- mixed $key: the key

Redefinition of:

TMap::itemAt()
  Returns the item with the specified key.

remove (line 120)

Removes an item from the map by its key.

This overrides the parent implementation by converting the key to lower case first if CaseSensitive is false.

- return: the removed value, null if no such key exists.
- access: public

mixed remove (mixed $key)

- mixed $key: the key of the item to be removed

Redefinition of:

TMap::remove()
  Removes an item from the map by its key.

setCaseSensitive (line 86)

- access: public

void setCaseSensitive (boolean $value)

- boolean $value: whether the keys are case-sensitive.

__get (line 57)

Returns a property value or an event handler list by property or event name.

This method overrides the parent implementation by returning a key value if the key exists in the collection.

- return: the property value or the event handler list
- access: public
- throws: TInvalidOperationException if the property/event is not defined.

mixed __get (string $name)

- string $name: the property name or the event name

Redefinition of:

TComponent::__get()
  Returns a property value or an event handler list by property or event name.

__set (line 70)

Sets value of a component property.

This method overrides the parent implementation by adding a new key value to the collection.

- access: public
- throws: TInvalidOperationException If the property is not defined or read-only.

void __set (string $name, mixed $value)

- string $name: the property name or event name
- mixed $value: the property value or event handler

Redefinition of:

TComponent::__set()
  Sets value of a component property.

#### Inherited Methods

Inherited From TMap

> TMap::__construct()
> TMap::add()
> TMap::clear()
> TMap::contains()
> TMap::copyFrom()
> TMap::count()
> TMap::getCount()
> TMap::getIterator()
> TMap::getKeys()
> TMap::getReadOnly()
> TMap::itemAt()
> TMap::mergeWith()
> TMap::offsetExists()
> TMap::offsetGet()
> TMap::offsetSet()
> TMap::offsetUnset()
> TMap::remove()
> TMap::setReadOnly()
> TMap::toArray()

Inherited From TComponent

> TComponent::addParsedObject()
> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::createdOnTemplate()
> TComponent::detachEventHandler()
> TComponent::evaluateExpression()
> TComponent::evaluateStatements()
> TComponent::getEventHandlers()
> TComponent::getSubProperty()
> TComponent::hasEvent()
> TComponent::hasEventHandler()
> TComponent::hasProperty()
> TComponent::raiseEvent()
> TComponent::setSubProperty()
> TComponent::__get()
> TComponent::__set()

Documentation generated on Mon, 22 Feb 2010 12:16:39 +0000 by phpDocumentor 1.3.0RC4