db backup prior to drupal security update
[yaffs-website] / vendor / phpunit / phpunit / tests / _files / SampleArrayAccess.php
1 <?php
2 /**
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
7  */
8 class SampleArrayAccess implements ArrayAccess
9 {
10     private $container;
11
12     public function __construct()
13     {
14         $this->container = array();
15     }
16     public function offsetSet($offset, $value)
17     {
18         if (is_null($offset)) {
19             $this->container[] = $value;
20         } else {
21             $this->container[$offset] = $value;
22         }
23     }
24     public function offsetExists($offset)
25     {
26         return isset($this->container[$offset]);
27     }
28     public function offsetUnset($offset)
29     {
30         unset($this->container[$offset]);
31     }
32     public function offsetGet($offset)
33     {
34         return isset($this->container[$offset]) ? $this->container[$offset] : null;
35     }
36 }