1 | <?php |
||
10 | class Slice extends Iterator |
||
11 | { |
||
12 | |||
13 | /** |
||
14 | * Slice constructor. |
||
15 | * |
||
16 | * @param array $data |
||
17 | * @param array|Slice $parameters |
||
18 | */ |
||
19 | 12 | public function __construct(array $data, $parameters = null) |
|
28 | |||
29 | /** |
||
30 | * @param array|\Traversable $data |
||
31 | * |
||
32 | * @return self |
||
33 | */ |
||
34 | 1 | public static function from($data): self |
|
45 | |||
46 | /** |
||
47 | * @param int|bool $depth |
||
48 | * |
||
49 | * @return array |
||
50 | */ |
||
51 | 5 | public function asArray($depth = INF) |
|
70 | |||
71 | /** |
||
72 | * @param Slice|array $slice |
||
73 | */ |
||
74 | 12 | protected function walk($slice) |
|
104 | |||
105 | /** |
||
106 | * @return \Generator|Slice[] |
||
107 | */ |
||
108 | 1 | public function asGenerator() |
|
115 | |||
116 | /** |
||
117 | * @return array |
||
118 | */ |
||
119 | 1 | public function keys() |
|
123 | |||
124 | /** |
||
125 | * @return Slice[] |
||
126 | */ |
||
127 | 1 | public function asObject() |
|
131 | |||
132 | /** |
||
133 | * @param array $data |
||
134 | * |
||
135 | * @return static |
||
136 | */ |
||
137 | 12 | public function setData(array $data) |
|
143 | |||
144 | /** |
||
145 | * @param string $offset |
||
146 | * @param mixed $default |
||
147 | * |
||
148 | * @return mixed |
||
149 | */ |
||
150 | 2 | public function getData($offset, $default = null) |
|
154 | |||
155 | /** |
||
156 | * @param string $offset |
||
157 | * |
||
158 | * @return Slice |
||
159 | */ |
||
160 | 1 | public function getSlice($offset) |
|
164 | |||
165 | /** |
||
166 | * @param array $data |
||
167 | * |
||
168 | * @return Slice |
||
169 | */ |
||
170 | 12 | public function make(array $data) |
|
174 | |||
175 | /** |
||
176 | * @param string $offset |
||
177 | * |
||
178 | * @return array|mixed |
||
179 | */ |
||
180 | 12 | public function getRequired($offset) |
|
184 | |||
185 | /** |
||
186 | * @inheritdoc |
||
187 | */ |
||
188 | 1 | public function offsetExists($offset) |
|
192 | |||
193 | /** |
||
194 | * @inheritdoc |
||
195 | */ |
||
196 | 4 | public function offsetGet($offset) |
|
200 | |||
201 | /** |
||
202 | * @inheritdoc |
||
203 | */ |
||
204 | 3 | public function offsetSet($offset, $value) |
|
213 | |||
214 | /** |
||
215 | * @inheritdoc |
||
216 | */ |
||
217 | 2 | public function offsetUnset($offset) |
|
221 | |||
222 | } |
||
223 |