MediaWiki  1.23.2
GenericArrayObject Class Reference
Inheritance diagram for GenericArrayObject:
Collaboration diagram for GenericArrayObject:

Public Member Functions

 __construct ( $input=null, $flags=0, $iterator_class='ArrayIterator')
 Constructor. More...
 
 append ( $value)
 
 getObjectType ()
 Returns the name of an interface/class that the element should implement/extend. More...
 
 isEmpty ()
 Returns if the ArrayObject has no elements. More...
 
 offsetSet ( $index, $value)
 
 serialize ()
 
 unserialize ( $serialization)
 

Protected Member Functions

 getNewOffset ()
 Finds a new offset for when appending an element. More...
 
 getSerializationData ()
 Returns an array holding all the data that should go into serialization calls. More...
 
 hasValidType ( $value)
 Returns if the provided value has the same type as the elements that can be added to this ArrayObject. More...
 
 preSetElement ( $index, $value)
 Gets called before a new element is added to the ArrayObject. More...
 
 setElement ( $index, $value)
 Method that actually sets the element and holds all common code needed for set operations, including type checking and offset resolving. More...
 

Protected Attributes

integer $indexOffset = 0
 

Detailed Description

Definition at line 35 of file GenericArrayObject.php.

Constructor & Destructor Documentation

◆ __construct()

GenericArrayObject::__construct (   $input = null,
  $flags = 0,
  $iterator_class = 'ArrayIterator' 
)

Constructor.

See also
ArrayObject::__construct
Since
1.20
Parameters
null | array$input
int$flags
string$iterator_class

Definition at line 79 of file GenericArrayObject.php.

References $flags, $value, array(), as, and offsetSet().

Member Function Documentation

◆ append()

GenericArrayObject::append (   $value)
See also
ArrayObject::append
Since
1.20
Parameters
mixed$value

Definition at line 96 of file GenericArrayObject.php.

References $value, and setElement().

Referenced by GenericArrayObjectTest\testAppend().

◆ getNewOffset()

GenericArrayObject::getNewOffset ( )
protected

Finds a new offset for when appending an element.

The base class does this, so it would be better to integrate, but there does not appear to be any way to do this...

Since
1.20
Returns
integer

Definition at line 61 of file GenericArrayObject.php.

References $indexOffset.

Referenced by setElement().

◆ getObjectType()

GenericArrayObject::getObjectType ( )
abstract

Returns the name of an interface/class that the element should implement/extend.

Since
1.20
Returns
string

Reimplemented in SiteList.

Referenced by hasValidType(), and setElement().

◆ getSerializationData()

GenericArrayObject::getSerializationData ( )
protected

Returns an array holding all the data that should go into serialization calls.

This is intended to allow overloading without having to reimplement the behavior of this base class.

Since
1.20
Returns
array

Reimplemented in SiteList.

Definition at line 199 of file GenericArrayObject.php.

References array().

Referenced by serialize().

◆ hasValidType()

GenericArrayObject::hasValidType (   $value)
protected

Returns if the provided value has the same type as the elements that can be added to this ArrayObject.

Since
1.20
Parameters
mixed$value
Returns
boolean

Definition at line 122 of file GenericArrayObject.php.

References $value, and getObjectType().

Referenced by setElement().

◆ isEmpty()

GenericArrayObject::isEmpty ( )

Returns if the ArrayObject has no elements.

Since
1.20
Returns
boolean

Reimplemented in SiteList.

Definition at line 236 of file GenericArrayObject.php.

Referenced by GenericArrayObjectTest\testUnset().

◆ offsetSet()

GenericArrayObject::offsetSet (   $index,
  $value 
)
See also
ArrayObject::offsetSet()
Since
1.20
Parameters
mixed$index
mixed$value

Definition at line 108 of file GenericArrayObject.php.

References $value, and setElement().

Referenced by __construct(), and GenericArrayObjectTest\testOffsetSet().

◆ preSetElement()

GenericArrayObject::preSetElement (   $index,
  $value 
)
protected

Gets called before a new element is added to the ArrayObject.

At this point the index is always set (ie not null) and the value is always of the type returned by

See also
getObjectType.

Should return a boolean. When false is returned the element does not get added to the ArrayObject.

Since
1.20
Parameters
integer | string$index
mixed$value
Returns
boolean

Reimplemented in SiteList.

Definition at line 175 of file GenericArrayObject.php.

Referenced by setElement().

◆ serialize()

GenericArrayObject::serialize ( )
See also
Serializable::serialize
Since
1.20
Returns
string

Definition at line 186 of file GenericArrayObject.php.

References getSerializationData().

◆ setElement()

GenericArrayObject::setElement (   $index,
  $value 
)
protected

Method that actually sets the element and holds all common code needed for set operations, including type checking and offset resolving.

If you want to do additional indexing or have code that otherwise needs to be executed whenever an element is added, you can overload

See also
preSetElement.
Since
1.20
Parameters
mixed$index
mixed$value
Exceptions
InvalidArgumentException

Definition at line 143 of file GenericArrayObject.php.

References $value, getNewOffset(), getObjectType(), hasValidType(), and preSetElement().

Referenced by append(), and offsetSet().

◆ unserialize()

GenericArrayObject::unserialize (   $serialization)
See also
Serializable::unserialize
Since
1.20
Parameters
string$serialization
Returns
array

Reimplemented in SiteList.

Definition at line 215 of file GenericArrayObject.php.

References $value, and as.

Member Data Documentation

◆ $indexOffset

integer GenericArrayObject::$indexOffset = 0
protected
See also
SiteList::getNewOffset()
Since
1.20

Definition at line 50 of file GenericArrayObject.php.

Referenced by getNewOffset().


The documentation for this class was generated from the following file: