1 | <?php |
||
21 | trait ArrayAccessTrait |
||
22 | { |
||
23 | /** |
||
24 | * Returns an iterator for traversing the data. |
||
25 | * This method is required by the SPL interface [[\IteratorAggregate]]. |
||
26 | * It will be implicitly called when you use `foreach` to traverse the collection. |
||
27 | * @return \ArrayIterator an iterator for traversing the cookies in the collection. |
||
28 | */ |
||
29 | public function getIterator() |
||
33 | |||
34 | /** |
||
35 | * Returns the number of data items. |
||
36 | * This method is required by Countable interface. |
||
37 | * @return integer number of data elements. |
||
38 | */ |
||
39 | 3 | public function count() |
|
43 | |||
44 | /** |
||
45 | * This method is required by the interface [[\ArrayAccess]]. |
||
46 | * @param mixed $offset the offset to check on |
||
47 | * @return boolean |
||
48 | */ |
||
49 | public function offsetExists($offset) |
||
53 | |||
54 | /** |
||
55 | * This method is required by the interface [[\ArrayAccess]]. |
||
56 | * @param integer $offset the offset to retrieve element. |
||
57 | * @return mixed the element at the offset, null if no element is found at the offset |
||
58 | */ |
||
59 | 4 | public function offsetGet($offset) |
|
63 | |||
64 | /** |
||
65 | * This method is required by the interface [[\ArrayAccess]]. |
||
66 | * @param integer $offset the offset to set element |
||
67 | * @param mixed $item the element value |
||
68 | */ |
||
69 | public function offsetSet($offset, $item) |
||
73 | |||
74 | /** |
||
75 | * This method is required by the interface [[\ArrayAccess]]. |
||
76 | * @param mixed $offset the offset to unset element |
||
77 | */ |
||
78 | public function offsetUnset($offset) |
||
82 | } |
||
83 |