Conditions | 3 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3.243 |
Changes | 0 |
1 | <?php |
||
30 | 5 | public function assocArrToObject(array $array): stdClass |
|
31 | { |
||
32 | try { |
||
33 | 5 | if ($this->isAssoc($array) === false) { |
|
34 | throw new RuntimeException('Array is not associative'); |
||
35 | } |
||
36 | |||
37 | 5 | return json_decode( |
|
38 | 5 | json_encode($array, JSON_THROW_ON_ERROR), |
|
39 | 5 | false, |
|
40 | 5 | 512, |
|
41 | 5 | JSON_THROW_ON_ERROR |
|
42 | ); |
||
43 | } catch (Exception $e) { |
||
44 | throw new ParseErrorException('', 0, $e->getPrevious()); |
||
45 | } |
||
66 |