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;