| Conditions | 3 |
| Paths | 3 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | 4 | public function normalize(JsonRpcResponse $response) |
|
| 27 | { |
||
| 28 | 4 | if ($response->isNotification()) { |
|
| 29 | 1 | return null; |
|
| 30 | } |
||
| 31 | |||
| 32 | $data = [ |
||
| 33 | 3 | self::KEY_JSON_RPC => $response->getJsonRpc(), |
|
| 34 | 3 | self::KEY_ID => $response->getId() |
|
| 35 | ]; |
||
| 36 | |||
| 37 | 3 | if ($response->getError()) { |
|
| 38 | 2 | $data[self::KEY_ERROR] = $this->normalizeError( |
|
| 39 | 2 | $response->getError() |
|
| 40 | ); |
||
| 41 | } else { |
||
| 42 | 1 | $data[self::KEY_RESULT] = $response->getResult(); |
|
| 43 | } |
||
| 44 | |||
| 45 | 3 | return $data; |
|
| 46 | } |
||
| 67 |