Conditions | 5 |
Paths | 8 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 6.6 |
Changes | 0 |
1 | <?php |
||
22 | 2 | public function read($path): array |
|
23 | { |
||
24 | 2 | $skippable = 0 === strncmp($path, '?', 1); |
|
25 | 2 | if ($skippable) { |
|
26 | $path = substr($path, 1); |
||
27 | } |
||
28 | |||
29 | 2 | if (is_readable($path)) { |
|
30 | 2 | $res = $this->readRaw($path); |
|
31 | |||
32 | 2 | return is_array($res) ? $res : []; |
|
33 | } |
||
34 | |||
35 | if (!$skippable) { |
||
36 | throw new FailedReadException("Failed read file: $path"); |
||
37 | } |
||
38 | |||
39 | return []; |
||
40 | } |
||
54 |