Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php declare(strict_types = 1); |
||
45 | public function fromString(string $configuration): array |
||
46 | { |
||
47 | $array = json_decode($configuration, true); |
||
48 | if (json_last_error() !== JSON_ERROR_NONE) { |
||
49 | throw new \RuntimeException( |
||
50 | sprintf('Unable to parse configuration string: "%s".', json_last_error_msg()), |
||
51 | json_last_error() |
||
52 | ); |
||
53 | } |
||
54 | |||
55 | return $array; |
||
56 | } |
||
57 | |||
65 | } |