| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 31 | public function __construct($body, $format) |
||
| 32 | { |
||
| 33 | switch ($format) { |
||
| 34 | case 'xml': |
||
| 35 | libxml_use_internal_errors(true); |
||
| 36 | $res = simplexml_load_string((string) $body); |
||
| 37 | if ($res) { |
||
| 38 | $res = json_decode(json_encode($res)); |
||
| 39 | } |
||
| 40 | break; |
||
| 41 | case 'json': |
||
| 42 | $res = json_decode((string) $body); |
||
| 43 | break; |
||
| 44 | default: |
||
| 45 | $res = (string) $body; |
||
| 46 | break; |
||
| 47 | } |
||
| 48 | $this->parseResponseBody($res); |
||
| 49 | } |
||
| 72 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.