| Conditions | 4 |
| Paths | 5 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 95 | public function parseJsonResponse($jsonResponse): self |
||
| 96 | { |
||
| 97 | if (!is_array($jsonResponse)) { |
||
| 98 | throw new \RuntimeException('Response must be a scalar value'); |
||
| 99 | } |
||
| 100 | if (array_key_exists('gcId', $jsonResponse)) { |
||
| 101 | $this->_id = $jsonResponse['gcId']; |
||
| 102 | } |
||
| 103 | if (array_key_exists('creationRequestId', $jsonResponse)) { |
||
| 104 | $this->_creation_request_id = $jsonResponse['creationRequestId']; |
||
| 105 | } |
||
| 106 | |||
| 107 | return $this; |
||
| 108 | |||
| 111 | } |
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.