3 * Sample class that implements ArrayAccess copied from
4 * http://www.php.net/manual/en/class.arrayaccess.php
5 * with some minor changes
6 * This class required for PHPUnit_Framework_Constraint_ArrayHasKey testing
8 class SampleArrayAccess implements ArrayAccess
12 public function __construct()
14 $this->container = array();
16 public function offsetSet($offset, $value)
18 if (is_null($offset)) {
19 $this->container[] = $value;
21 $this->container[$offset] = $value;
24 public function offsetExists($offset)
26 return isset($this->container[$offset]);
28 public function offsetUnset($offset)
30 unset($this->container[$offset]);
32 public function offsetGet($offset)
34 return isset($this->container[$offset]) ? $this->container[$offset] : null;