Conditions | 4 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4.016 |
Changes | 0 |
1 | <?php |
||
17 | 3 | public static function transformData($content) |
|
18 | { |
||
19 | 3 | if (!function_exists('simplexml_load_string')) |
|
20 | 3 | { |
|
21 | throw new DependencyMissingException('XML', 'XML support is not available with the current PHP installation.'); |
||
22 | } |
||
23 | |||
24 | 3 | libxml_use_internal_errors(true); |
|
25 | 3 | $data = json_decode(json_encode(simplexml_load_string($content)), true); |
|
26 | |||
27 | 3 | if ($data === false || $data === null) |
|
28 | 3 | { |
|
29 | 1 | return []; |
|
30 | } |
||
31 | |||
32 | 2 | return $data; |
|
33 | } |
||
34 | |||
45 |