Conditions | 7 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 7.9936 |
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 | return $response; |
||
33 | } |
||
34 | 1 | $data = $stream->getBucket(); |
|
35 | 1 | if ($data === null || !$data->isConvertable()) { |
|
36 | return $response; |
||
37 | } |
||
38 | 1 | if ((!$stream->hasBucketFormat() && !$stream->isRenderStarted()) || $this->force) { |
|
39 | 1 | return $response->withBody($stream->withBucket($data->withFormat($this->format, $this->params))); |
|
40 | } |
||
41 | return $response; |
||
42 | } |
||
44 |