1 | <?php |
||
9 | class Slice extends Iterator |
||
10 | { |
||
11 | |||
12 | /** |
||
13 | * Slice constructor. |
||
14 | * |
||
15 | * @param array $data |
||
16 | * @param array|Slice $parameters |
||
17 | */ |
||
18 | 12 | public function __construct(array $data, $parameters = null) |
|
27 | |||
28 | /** |
||
29 | * @param array|\Traversable $data |
||
30 | * |
||
31 | * @return self |
||
32 | */ |
||
33 | 1 | public static function from($data): self |
|
44 | |||
45 | /** |
||
46 | * @param int $depth |
||
47 | * |
||
48 | * @return array |
||
49 | */ |
||
50 | 5 | public function asArray($depth = INF) |
|
69 | |||
70 | /** |
||
71 | * @param Slice|array $slice |
||
72 | */ |
||
73 | 12 | protected function walk($slice) |
|
89 | |||
90 | /** |
||
91 | * @return \Generator|Slice[] |
||
92 | */ |
||
93 | 1 | public function asGenerator() |
|
100 | |||
101 | /** |
||
102 | * @return array |
||
103 | */ |
||
104 | 1 | public function keys() |
|
108 | |||
109 | /** |
||
110 | * @return Slice[] |
||
111 | */ |
||
112 | 1 | public function asObject() |
|
116 | |||
117 | /** |
||
118 | * @param array $data |
||
119 | * |
||
120 | * @return static |
||
121 | */ |
||
122 | 12 | public function setData(array $data) |
|
128 | |||
129 | /** |
||
130 | * @param string $offset |
||
131 | * @param mixed $default |
||
132 | * |
||
133 | * @return mixed |
||
134 | */ |
||
135 | 12 | public function getData($offset, $default = null) |
|
139 | |||
140 | /** |
||
141 | * @param string $offset |
||
142 | * |
||
143 | * @return Slice |
||
144 | */ |
||
145 | 1 | public function getSlice($offset) |
|
149 | |||
150 | /** |
||
151 | * @param array $data |
||
152 | * |
||
153 | * @return Slice |
||
154 | */ |
||
155 | 12 | public function make(array $data) |
|
159 | |||
160 | /** |
||
161 | * @param string $offset |
||
162 | * |
||
163 | * @return array|mixed |
||
164 | */ |
||
165 | 3 | public function getRequired($offset) |
|
169 | |||
170 | /** |
||
171 | * @inheritdoc |
||
172 | */ |
||
173 | 1 | public function offsetExists($offset) |
|
177 | |||
178 | /** |
||
179 | * @inheritdoc |
||
180 | */ |
||
181 | 3 | public function offsetGet($offset) |
|
185 | |||
186 | /** |
||
187 | * @inheritdoc |
||
188 | */ |
||
189 | 3 | public function offsetSet($offset, $value) |
|
198 | |||
199 | /** |
||
200 | * @inheritdoc |
||
201 | */ |
||
202 | 1 | public function offsetUnset($offset) |
|
206 | |||
207 | } |
||
208 |