items[$offset]); } /** * Returns the value at specified offset. * * @param mixed $offset The offset to retrieve. * @return mixed Can return all value types. */ public function offsetGet($offset) { return isset($this->items[$offset]) ? $this->items[$offset] : null; } /** * Assigns a value to the specified offset. * * @param mixed $offset The offset to assign the value to. * @param mixed $value The value to set. */ public function offsetSet($offset, $value) { if (is_null($offset)) { $this->items[] = $value; } else { $this->items[$offset] = $value; } } /** * Unsets an offset. * * @param mixed $offset The offset to unset. */ public function offsetUnset($offset) { // Hack to make Iterator trait work together with unset. if (isset($this->iteratorUnset) && $offset == key($this->items)) { $this->iteratorUnset = true; } unset($this->items[$offset]); } }