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