62 while ( $this->offsetExists( $this->indexOffset ) ) {
78 public function __construct( $input =
null, $flags = 0, $iterator_class =
'ArrayIterator' ) {
79 parent::__construct( [], $flags, $iterator_class );
81 if ( !is_null( $input ) ) {
82 foreach ( $input as $offset => $value ) {
123 return $value instanceof $class;
144 throw new InvalidArgumentException(
145 'Can only add ' . $this->
getObjectType() .
' implementing objects to '
146 . static::class .
'.'
150 if ( is_null( $index ) ) {
155 parent::offsetSet( $index, $value );
201 'data' => $this->getArrayCopy(),
217 $serializationData =
unserialize( $serialization );
219 foreach ( $serializationData[
'data'] as $offset => $value ) {
222 parent::offsetSet( $offset, $value );
225 $this->indexOffset = $serializationData[
'index'];
227 return $serializationData;
238 return $this->count() === 0;
offsetSet( $index, $value)
setElement( $index, $value)
Method that actually sets the element and holds all common code needed for set operations,...
preSetElement( $index, $value)
Gets called before a new element is added to the ArrayObject.
__construct( $input=null, $flags=0, $iterator_class='ArrayIterator')
getNewOffset()
Finds a new offset for when appending an element.
getSerializationData()
Returns an array holding all the data that should go into serialization calls.
isEmpty()
Returns if the ArrayObject has no elements.
unserialize( $serialization)
getObjectType()
Returns the name of an interface/class that the element should implement/extend.
hasValidType( $value)
Returns if the provided value has the same type as the elements that can be added to this ArrayObject...