Total Complexity | 6 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | class Filename extends Source |
||
15 | { |
||
16 | /** |
||
17 | * Retrieve the JSON fragments |
||
18 | * |
||
19 | * @return Traversable<int, string> |
||
20 | */ |
||
21 | 19 | public function getIterator(): Traversable |
|
22 | { |
||
23 | 19 | $handle = fopen($this->source, 'rb'); |
|
24 | |||
25 | try { |
||
26 | 19 | yield from new JsonResource($handle, $this->config); |
|
27 | } finally { |
||
28 | 19 | $handle && fclose($handle); |
|
29 | } |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Determine whether the JSON source can be handled |
||
34 | * |
||
35 | * @return bool |
||
36 | */ |
||
37 | 348 | public function matches(): bool |
|
40 | } |
||
41 | |||
42 | /** |
||
43 | * Retrieve the calculated size of the JSON source |
||
44 | * |
||
45 | * @return int|null |
||
46 | */ |
||
47 | 2 | protected function calculateSize(): ?int |
|
52 |