| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| 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 | |||
| 38 | /** @var Converter $converter */ |
||
| 39 | $converter = $this->container->get($converterClass); |
||
| 40 | $stream->render($converter); |
||
| 41 | |||
| 42 | return $response->withHeader('Content-Type', $converter::getFormat()); |
||
| 43 | } |
||
| 45 |