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