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 ( $input !==
null ) {
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 ( $index ===
null ) {
155 parent::offsetSet( $index, $value );
212 'data' => $this->getArrayCopy(),
236 foreach ( $serializationData[
'data'] as $offset => $value ) {
239 parent::offsetSet( $offset, $value );
242 $this->indexOffset = $serializationData[
'index'];
253 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,...
__unserialize( $serializationData)
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...