| Conditions | 3 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | public function decode($data, $format) |
||
| 20 | 5 | { |
|
| 21 | $context = []; |
||
| 22 | 5 | ||
| 23 | if ($format === 'json') { |
||
| 24 | 4 | // the JSON schema validator need an object hierarchy |
|
| 25 | $context['json_decode_associative'] = false; |
||
| 26 | } |
||
| 27 | 5 | ||
| 28 | $decoded = $this->decoder->decode($data, $format, $context); |
||
| 29 | 5 | ||
| 30 | if ($format === 'xml') { |
||
| 31 | 1 | // the JSON schema validator need an object hierarchy |
|
| 32 | $decoded = json_decode(json_encode($decoded)); |
||
| 33 | } |
||
| 34 | 5 | ||
| 35 | return $decoded; |
||
| 36 | } |
||
| 38 |