Conditions | 4 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | public function onPlainResponse(ViewEvent $event) |
||
13 | { |
||
14 | $request = $event->getRequest(); |
||
15 | $response = $event->getResponse(); |
||
16 | |||
17 | // No need to perform JSON-RPC serialization here |
||
18 | if (!$request instanceof RichJsonRpcRequest || $request->isNotification()) { |
||
19 | return; |
||
20 | } |
||
21 | |||
22 | // Response is already properly formatted |
||
23 | if ($response instanceof JsonRpcResponseInterface) { |
||
24 | return; |
||
25 | } |
||
26 | |||
27 | $response = new JsonRpcResponse($request->getId(), $response); |
||
28 | |||
29 | $event->setResponse($response); |
||
30 | } |
||
31 | } |
||
32 |