data = array_values($data); } public function offsetExists($offset){ $this->fire('exists', $offset); return isset($this->data[$offset]); } public function offsetGet($offset){ $this->fire('get', $offset); return $this->data[$offset]; } public function offsetSet($offset, $value){ $this->fire('set', $offset, $value); $this->data[$offset] = $value; } public function offsetUnset($offset){ $this->fire('unset', $offset, $this[$offset]); unset($this->data[$offset]); } public function each(callable $fn){ foreach($this->data as $offset => $model){ $fn($model, $offset); } return $this; } } ?>