Total Complexity | 6 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
15 | class JsonResource extends Source |
||
16 | { |
||
17 | /** |
||
18 | * Retrieve the JSON fragments |
||
19 | * |
||
20 | * @return Traversable<int, string> |
||
21 | */ |
||
22 | 26 | public function getIterator(): Traversable |
|
23 | { |
||
24 | 26 | while (!feof($this->source)) { |
|
25 | 26 | if (is_string($chunk = fread($this->source, $this->config->bytes))) { |
|
26 | 26 | yield $chunk; |
|
27 | } |
||
28 | } |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Determine whether the JSON source can be handled |
||
33 | * |
||
34 | * @return bool |
||
35 | */ |
||
36 | 2 | public function matches(): bool |
|
39 | } |
||
40 | |||
41 | /** |
||
42 | * Retrieve the calculated size of the JSON source |
||
43 | * |
||
44 | * @return int|null |
||
45 | */ |
||
46 | 1 | protected function calculateSize(): ?int |
|
54 |