Conditions | 7 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 7.392 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
27 | 1 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
28 | { |
||
29 | 1 | $response = $handler->handle($request); |
|
30 | 1 | $stream = $response->getBody(); |
|
31 | 1 | if ($stream instanceof BucketStream) { |
|
32 | 1 | $data = $stream->getBucket(); |
|
33 | 1 | if ($data === null || !$data->isConvertable()) { |
|
34 | return $response; |
||
35 | } |
||
36 | 1 | if (!$stream->hasBucketFormat() && !$stream->isRenderStarted() || $this->force) { |
|
|
|||
37 | 1 | return $response->withBody($stream->withBucket($data->withFormat($this->format, $this->params))); |
|
38 | } |
||
39 | } |
||
40 | return $response; |
||
41 | } |
||
43 |