[FEATURE] Support 'has*' for properties in ObjectAccess
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Reflection / Fixture / ArrayAccessClass.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * ArrayAccess class for the Reflection tests
19 *
20 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
21 */
22 class ArrayAccessClass implements \ArrayAccess {
23
24 protected $array = array();
25
26 /**
27 * @param array $array
28 */
29 public function __construct(array $array) {
30 $this->array = $array;
31 }
32
33 /**
34 * @param mixed $offset
35 * @return bool
36 */
37 public function offsetExists($offset) {
38 return array_key_exists($offset, $this->array);
39 }
40
41 /**
42 * @param mixed $offset
43 * @return mixed
44 */
45 public function offsetGet($offset) {
46 return $this->array[$offset];
47 }
48
49 /**
50 * @param mixed $offset
51 * @param mixed $value
52 */
53 public function offsetSet($offset, $value) {
54 $this->array[$offset] = $value;
55 }
56
57 /**
58 * @param mixed $offset
59 */
60 public function offsetUnset($offset) {
61 unset($this->array[$offset]);
62 }
63
64 }