Conditions | 4 |
Paths | 5 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
10 | public function run(array $args, \DomElement $element = null) { |
||
11 | $json = $args[0]; |
||
12 | |||
13 | if ($this->isJsonFile($json)) { |
||
14 | $path = $this->baseDir . $json; |
||
15 | if (!file_exists($path)) throw new \Exception('File does not exist at: ' . $path); |
||
16 | $json = file_get_contents($path); |
||
17 | } |
||
18 | |||
19 | $map = json_decode($json, true); |
||
20 | |||
21 | if (!is_array($map)) throw new \Exception('Could not decode json: ' . json_last_error_msg()); |
||
22 | |||
23 | return $map; |
||
24 | } |
||
25 | |||
30 |