## 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: $Revision: $ $Date: $
- 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 hasProperty (string $name)
mixed itemAt (mixed $key)
mixed remove (mixed $key)
mixed __get (string $name)
void __set (string $name, mixed $value)
Methods
add (line 91)

Adds an item into the map.

This overrides the parent implementation by converting the key to lower case first.

- 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 137)

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 149)

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 113)

Returns whether the specified is in the map.

This overrides the parent implementation by converting the key to lower case first.

- 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()

hasProperty (line 125)

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 79)

Returns the item with the specified key.

This overrides the parent implementation by converting the key to lower case first.

- 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 102)

Removes an item from the map by its key.

This overrides the parent implementation by converting the key to lower case first.

- 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.

__get (line 55)

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 68)

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::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::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> 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, 01 May 2006 23:02:45 -0400 by phpDocumentor 1.3.0RC4