Conditions | 9 |
Paths | 7 |
Total Lines | 25 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 9 |
Changes | 0 |
1 | <?php |
||
25 | 3 | public function parseFile($path) |
|
26 | { |
||
27 | 3 | $fsIsStreamUri = Lib::fsIsStreamUri($path); |
|
28 | 3 | if (!$fsIsStreamUri && (!is_file($path) || !is_readable($path))) { |
|
29 | 1 | return null; |
|
30 | } |
||
31 | |||
32 | 3 | $error = ErrorCatcher::create(); |
|
33 | |||
34 | 3 | if ($fsIsStreamUri) { |
|
35 | 1 | $path = file_get_contents($path); |
|
36 | } |
||
37 | |||
38 | 3 | $array = MustangostangSpyc::YAMLLoad($path); |
|
39 | |||
40 | 3 | if ($error->end() || !is_array($array) || array() === $array) { |
|
41 | 1 | return null; |
|
42 | } |
||
43 | |||
44 | 3 | $keys = array_keys($array); |
|
45 | 3 | if ($keys === range(0, count($array) - 1, 1)) { |
|
46 | 2 | return null; |
|
47 | } |
||
48 | |||
49 | 1 | return $array; |
|
50 | } |
||
65 |