Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
25 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
||
26 | { |
||
27 | $response = $handler->handle($request); |
||
28 | $stream = $response->getBody(); |
||
29 | if (!$stream instanceof DataStream) { |
||
30 | return $response; |
||
31 | } |
||
32 | $converterClass = $stream->getConverter(); |
||
33 | if ($converterClass === null) { |
||
34 | # todo: get most relevant format from header |
||
35 | $converterClass = PrintRConverter::class; |
||
36 | } |
||
37 | /** @var Converter $converter */ |
||
38 | $converter = $this->container->get($converterClass); |
||
39 | $stream->render($converter); |
||
40 | |||
41 | return $converter->setHeaders($response); |
||
|
|||
42 | } |
||
44 |