1 | <?php |
||
12 | final class AresRecords implements \ArrayAccess, \IteratorAggregate, \Countable |
||
13 | { |
||
14 | /** |
||
15 | * @var AresRecord[] |
||
16 | */ |
||
17 | private $array = []; |
||
18 | |||
19 | /** |
||
20 | * @param mixed $offset |
||
21 | * |
||
22 | * @return bool |
||
23 | */ |
||
24 | public function offsetExists($offset) |
||
25 | { |
||
26 | if (isset($this->array[$offset])) { |
||
27 | return true; |
||
28 | } else { |
||
29 | return false; |
||
30 | } |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @param mixed $offset |
||
35 | * |
||
36 | * @return bool|AresRecord |
||
37 | */ |
||
38 | public function offsetGet($offset) |
||
46 | |||
47 | /** |
||
48 | * @param mixed $offset |
||
49 | * @param AresRecord $value |
||
50 | */ |
||
51 | public function offsetSet($offset, $value) |
||
52 | { |
||
53 | if ($offset) { |
||
54 | $this->array[$offset] = $value; |
||
55 | } else { |
||
56 | $this->array[] = $value; |
||
57 | } |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @param mixed $offset |
||
62 | */ |
||
63 | public function offsetUnset($offset) |
||
67 | |||
68 | /** |
||
69 | * @return ArrayIterator |
||
70 | */ |
||
71 | public function getIterator() |
||
72 | { |
||
73 | return new ArrayIterator($this->array); |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * {@inheritdoc} |
||
78 | */ |
||
79 | public function count() |
||
83 | } |
||
84 |