| Conditions | 1 |
| Paths | 1 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 1 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | 1 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
| 18 | { |
||
| 19 | 1 | $uri = $request->getUri(); |
|
| 20 | |||
| 21 | $hal = [ |
||
| 22 | '_links' => [ |
||
| 23 | 'self' => [ |
||
| 24 | 1 | 'href' => $uri->getScheme() . '://' . $uri->getHost() . $uri->getPath(), |
|
| 25 | ] |
||
| 26 | ], |
||
| 27 | ]; |
||
| 28 | |||
| 29 | 1 | $response = $handler->handle($request); |
|
| 30 | |||
| 31 | 1 | $data = \json_decode($response->getBody()->getContents(), true); |
|
| 32 | 1 | $data = \array_merge($hal, $data); |
|
| 33 | |||
| 34 | 1 | $body = $response->getBody(); |
|
| 35 | 1 | $body->rewind(); |
|
| 36 | 1 | $body->write(\json_encode($data)); |
|
| 37 | |||
| 38 | 1 | return $response->withBody($body); |
|
| 39 | } |
||
| 40 | } |