| Conditions | 3 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | 34 | public function createSerializationContext($request): array |
|
| 33 | { |
||
| 34 | $context = [ |
||
| 35 | 34 | 'result_types_by_methods' => $this->resultTypesByMethods, |
|
| 36 | 34 | 'error_type' => $this->errorType, |
|
| 37 | ]; |
||
| 38 | |||
| 39 | 34 | if ($request instanceof RequestObjectInterface) { |
|
| 40 | 25 | $context['request'] = $request; |
|
| 41 | } else { |
||
| 42 | 9 | $requests = []; |
|
| 43 | |||
| 44 | /** @var RequestObjectInterface $singleRequest */ |
||
| 45 | 9 | foreach ($request as $singleRequest) { |
|
| 46 | 9 | $requests[$singleRequest->getId()] = $singleRequest; |
|
| 47 | } |
||
| 48 | |||
| 49 | 9 | $context['requests'] = $requests; |
|
| 50 | } |
||
| 51 | |||
| 52 | 34 | return ['json_rpc' => $context]; |
|
| 53 | } |
||
| 55 |