Total Complexity | 6 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | class Json extends Source |
||
17 | { |
||
18 | use DetectsEndpoints; |
||
19 | |||
20 | /** |
||
21 | * Retrieve the JSON fragments |
||
22 | * |
||
23 | * @return Traversable<int, string> |
||
24 | */ |
||
25 | 331 | public function getIterator(): Traversable |
|
26 | { |
||
27 | 331 | for ($i = 0; $i < $this->size(); $i += $this->config->bytes) { |
|
28 | 331 | yield substr($this->source, $i, $this->config->bytes); |
|
29 | } |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Determine whether the JSON source can be handled |
||
34 | * |
||
35 | * @return bool |
||
36 | */ |
||
37 | 330 | public function matches(): bool |
|
40 | } |
||
41 | |||
42 | /** |
||
43 | * Retrieve the calculated size of the JSON source |
||
44 | * |
||
45 | * @return int|null |
||
46 | */ |
||
47 | 331 | protected function calculateSize(): ?int |
|
50 | } |
||
51 | } |
||
52 |