Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
20 | public function readToArray($source) |
||
21 | { |
||
22 | if (!file_exists($source)) { |
||
23 | throw new \Vaimo\ComposerPatches\Exceptions\ReadException( |
||
24 | sprintf('File not found: %s', $source) |
||
25 | ); |
||
26 | } |
||
27 | |||
28 | $sourceData = file_get_contents($source); |
||
29 | |||
30 | if ($sourceData === false) { |
||
31 | throw new \Vaimo\ComposerPatches\Exceptions\ReadException( |
||
32 | sprintf('Failed to retrieve contents: %s', $source) |
||
33 | ); |
||
34 | } |
||
35 | |||
36 | return $this->jsonDecoder->parse( |
||
37 | $sourceData, |
||
38 | \Seld\JsonLint\JsonParser::PARSE_TO_ASSOC |
||
39 | ); |
||
42 |