_items); } else if (is_array($srcArray)) { $this->_items = $srcArray; } else { throw new Exception('Array can be initialized only by other array'); } } public function current() { return current($this->_items); } public function next() { return next($this->_items); } public function key() { return key($this->_items); } public function valid() { return current($this->_items)!==false; } public function rewind() { reset($this->_items); } public function offsetExists($offset) { return array_key_exists($offset, $this->_items); } public function offsetGet($offset) { return $this->_items[$offset]; } public function offsetSet($offset, $value) { if ($offset === null) { $this->_items[] = $value; } else { $this->_items[$offset] = $value; } } public function offsetUnset($offset) { unset($this->_items[$offset]); } public function clear() { $this->_items = array(); } /** * Defined by Countable interface * * @return int */ public function count() { return count($this->_items); } }