Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • CAttributeCollection
  • CConfiguration
  • CList
  • CListIterator
  • CMap
  • CMapIterator
  • CQueue
  • CQueueIterator
  • CStack
  • CStackIterator
  • CTypedList
  • CTypedMap
  • Overview
  • Package
  • Class
  • Tree

Class CAttributeCollection

CAttributeCollection implements a collection for storing attribute names and values.

Besides all functionalities provided by CMap, CAttributeCollection allows you to get and set attribute values like getting and setting properties. For example, the following usages are all valid for a CAttributeCollection object:

$collection->text='text'; // same as:  $collection->add('text','text');
echo $collection->text;   // same as:  echo $collection->itemAt('text');

The case sensitivity of attribute names can be toggled by setting the CAttributeCollection::$caseSensitive property of the collection.

CComponent
Extended by CMap implements IteratorAggregate, ArrayAccess, Countable
Extended by CAttributeCollection
Package: system\collections
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/collections/CAttributeCollection.php
Methods summary
public mixed
# __get( string $name )

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.

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.

Parameters

$name
string
$name the property name or the event name

Returns

mixed
the property value or the event handler list

Throws

CException
if the property/event is not defined.

Overrides

CComponent::__get()
public mixed
# __set( string $name, mixed $value )

Sets value of a component property. This method overrides the parent implementation by adding a new key value to the collection.

Sets value of a component property. This method overrides the parent implementation by adding a new key value to the collection.

Parameters

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

Returns

mixed

Throws

CException
If the property is not defined or read-only.

Overrides

CComponent::__set()
public boolean
# __isset( string $name )

Checks if a property value is null. This method overrides the parent implementation by checking if the key exists in the collection and contains a non-null value.

Checks if a property value is null. This method overrides the parent implementation by checking if the key exists in the collection and contains a non-null value.

Parameters

$name
string
$name the property name or the event name

Returns

boolean
whether the property value is null

Overrides

CComponent::__isset()
public mixed
# __unset( string $name )

Sets a component property to be null. This method overrides the parent implementation by clearing the specified key value.

Sets a component property to be null. This method overrides the parent implementation by clearing the specified key value.

Parameters

$name
string
$name the property name or the event name

Returns

mixed

Throws

CException
if the property is read only.

Overrides

CComponent::__unset()
public mixed
# itemAt( mixed $key )

Returns the item with the specified key. This overrides the parent implementation by converting the key to lower case first if CAttributeCollection::$caseSensitive is false.

Returns the item with the specified key. This overrides the parent implementation by converting the key to lower case first if CAttributeCollection::$caseSensitive is false.

Parameters

$key
mixed
$key the key

Returns

mixed
the element at the offset, null if no element is found at the offset

Overrides

CMap::itemAt()
public
# add( mixed $key, mixed $value )

Adds an item into the map. This overrides the parent implementation by converting the key to lower case first if CAttributeCollection::$caseSensitive is false.

Adds an item into the map. This overrides the parent implementation by converting the key to lower case first if CAttributeCollection::$caseSensitive is false.

Parameters

$key
mixed
$key key
$value
mixed
$value value

Throws

CException
if the map is read-only

Overrides

CMap::add()
public mixed
# remove( mixed $key )

Removes an item from the map by its key. This overrides the parent implementation by converting the key to lower case first if CAttributeCollection::$caseSensitive is false.

Removes an item from the map by its key. This overrides the parent implementation by converting the key to lower case first if CAttributeCollection::$caseSensitive is false.

Parameters

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

Returns

mixed
the removed value, null if no such key exists.

Throws

CException
if the map is read-only

Overrides

CMap::remove()
public boolean
# contains( mixed $key )

Returns whether the specified is in the map. This overrides the parent implementation by converting the key to lower case first if CAttributeCollection::$caseSensitive is false.

Returns whether the specified is in the map. This overrides the parent implementation by converting the key to lower case first if CAttributeCollection::$caseSensitive is false.

Parameters

$key
mixed
$key the key

Returns

boolean
whether the map contains an item with the specified key

Overrides

CMap::contains()
public boolean
# hasProperty( string $name )

Determines whether a property is defined. This method overrides parent implementation by returning true if the collection contains the named key.

Determines whether a property is defined. This method overrides parent implementation by returning true if the collection contains the named key.

Parameters

$name
string
$name the property name

Returns

boolean
whether the property is defined

Overrides

CComponent::hasProperty()
public boolean
# canGetProperty( string $name )

Determines whether a property can be read. This method overrides parent implementation by returning true if the collection contains the named key.

Determines whether a property can be read. This method overrides parent implementation by returning true if the collection contains the named key.

Parameters

$name
string
$name the property name

Returns

boolean
whether the property can be read

Overrides

CComponent::canGetProperty()
public boolean
# canSetProperty( string $name )

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.

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.

Parameters

$name
string
$name the property name

Returns

boolean
true

Overrides

CComponent::canSetProperty()
public
# mergeWith( mixed $data, boolean $recursive = true )

Merges iterable data into the map.

Merges iterable data into the map.

Existing elements in the map will be overwritten if their keys are the same as those in the source. If the merge is recursive, the following algorithm is performed:
  • the map data is saved as $a, and the source data is saved as $b;
  • if $a and $b both have an array indexed at the same string key, the arrays will be merged using this algorithm;
  • any integer-indexed elements in $b will be appended to $a and reindexed accordingly;
  • any string-indexed elements in $b will overwrite elements in $a with the same index;

Parameters

$data
mixed
$data the data to be merged with, must be an array or object implementing Traversable
$recursive
boolean
$recursive whether the merging should be recursive.

Throws

CException
If data is neither an array nor an iterator.

Overrides

CMap::mergeWith()
Methods inherited from CMap
__construct(), clear(), copyFrom(), count(), getCount(), getIterator(), getKeys(), getReadOnly(), mergeArray(), offsetExists(), offsetGet(), offsetSet(), offsetUnset(), setReadOnly(), toArray()
Methods inherited from CComponent
__call(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), raiseEvent()
Properties summary
public boolean $caseSensitive false
#

whether the keys are case-sensitive. Defaults to false.

whether the keys are case-sensitive. Defaults to false.

Magic properties inherited from CMap
$count, $iterator, $keys, $readOnly
API documentation generated by ApiGen 2.8.0