1 | <?php |
||
12 | class ObjectArray implements \ArrayAccess, \Countable, \IteratorAggregate, ToArrayInterface |
||
13 | { |
||
14 | private $objects = []; |
||
15 | |||
16 | /** |
||
17 | * @param object |
||
18 | */ |
||
19 | public function __construct() |
||
23 | |||
24 | /** |
||
25 | * @param ObjectArray|object[] $objects |
||
26 | * @return ObjectArray |
||
27 | * @throws InvalidArgumentException |
||
28 | */ |
||
29 | public static function fromArray($objects) |
||
42 | |||
43 | /** |
||
44 | * @return array |
||
45 | */ |
||
46 | public function toArray() |
||
55 | |||
56 | /** |
||
57 | * Convert elements to recursive array |
||
58 | * |
||
59 | * @param mixed $object |
||
60 | * @param int $rec ネストの深さ |
||
61 | */ |
||
62 | public static function toArrayRec($object, $rec = 5) |
||
84 | |||
85 | public function getObjects() |
||
89 | |||
90 | /** |
||
91 | * @return int |
||
92 | */ |
||
93 | public function count() |
||
97 | |||
98 | /** |
||
99 | * @param mixed offset |
||
100 | * @return bool |
||
101 | */ |
||
102 | public function offsetExists($offset) |
||
106 | |||
107 | /** |
||
108 | * @param mixed offset |
||
109 | * @return mixed |
||
110 | * @throws OutOfBoundsException |
||
111 | */ |
||
112 | public function offsetGet($offset) |
||
120 | |||
121 | /** |
||
122 | * @param mixed offset |
||
123 | * @param mixed value |
||
124 | * @return void |
||
125 | * @throws OutOfBoundsException |
||
126 | */ |
||
127 | public function offsetSet($offset, $value) |
||
135 | |||
136 | /** |
||
137 | * @param mixed offset |
||
138 | * @return void |
||
139 | */ |
||
140 | public function offsetUnset($offset) |
||
144 | |||
145 | /** |
||
146 | * @return \ArrayIterator |
||
147 | */ |
||
148 | public function getIterator() |
||
152 | } |
||
153 |