Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
44 | 5 | public static function getComposerJsonDecoded(string $path = null): array |
|
45 | { |
||
46 | 5 | $path = $path ?? self::getProjectRootDirectory().'/composer.json'; |
|
47 | 5 | $decoded = \json_decode(\file_get_contents($path), true); |
|
48 | 5 | if (JSON_ERROR_NONE !== \json_last_error()) { |
|
49 | 1 | throw new \RuntimeException('Failed loading composer.json: '.\json_last_error_msg()); |
|
50 | } |
||
51 | |||
52 | 4 | return $decoded; |
|
53 | } |
||
55 |