29 const TYPE_HINT = null;
32 protected $items = array();
37 return count($this->items);
43 return new ArrayIterator($this->items);
49 return $this->items[$offset];
55 $hint = static::TYPE_HINT;
56 if ($hint !== null && (!is_object($value) || !($value instanceof $hint))) {
57 throw new \Plop\Exception(
'An instance of ' . $hint .
' was expected');
60 if ($offset === null) {
61 $this->items[] = $value;
63 $this->items[$offset] = $value;
70 $res = @isset($this->items[$offset]) ||
71 (array_search($offset, $this->items,
true) !==
false);
78 if (!is_int($offset)) {
79 $offset = array_search($offset, $this->items,
true);
81 if (isset($this->items[$offset])) {
82 unset($this->items[$offset]);
Interface to provide accessing objects as arrays.
Interface to create an external Iterator.
A class that can be used to handle collections of objects.
offsetSet($offset, $value)
Classes implementing Countable can be used with the count() function.