Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
40 | private function verifyJSON(string $file): bool |
||
41 | { |
||
42 | // basic check on the JSON. |
||
43 | $json = file_get_contents($file); |
||
44 | try { |
||
45 | json_decode($json, true, 512, JSON_THROW_ON_ERROR); |
||
46 | } catch (Exception|JsonException $e) { |
||
47 | $message = sprintf('The importer can\'t import: could not decode the JSON in the config file: %s', $e->getMessage()); |
||
48 | Log::error($message); |
||
49 | |||
50 | return false; |
||
51 | |||
52 | } |
||
53 | |||
54 | return true; |
||
55 | } |
||
58 |