| Conditions | 3 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3.6511 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | 114 | public function deserialize(array $payloadResponse, $payloadResponseClass) |
|
| 28 | { |
||
| 29 | 114 | $payloadResponseObject = $this->serializer->deserialize( |
|
| 30 | 114 | json_encode($payloadResponse), |
|
| 31 | 114 | $payloadResponseClass, |
|
| 32 | 'json' |
||
| 33 | 114 | ); |
|
| 34 | |||
| 35 | 114 | if (!($payloadResponseObject instanceof PayloadResponseInterface)) { |
|
| 36 | throw new \RuntimeException(sprintf( |
||
| 37 | 'The serializer expected the response data to be converted into an instance of "%s", got: %s', |
||
| 38 | $payloadResponseClass, |
||
| 39 | is_object($payloadResponseObject) ? 'instance of ' . get_class($payloadResponseObject) : gettype($payloadResponseObject) |
||
| 40 | )); |
||
| 41 | } |
||
| 42 | |||
| 43 | 114 | return $payloadResponseObject; |
|
| 44 | } |
||
| 45 | } |
||
| 46 |