| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 35 | 1 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
| 36 | { |
||
| 37 | // https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Encoding |
||
| 38 | 1 | if ($request->getHeaderLine('Content-Encoding') === 'base64') { |
|
| 39 | /** @var resource $resource */ |
||
| 40 | 1 | $resource = $request->getBody()->detach(); |
|
| 41 | // https://www.php.net/manual/en/filters.convert.php |
||
| 42 | 1 | \stream_filter_append($resource, 'convert.base64-decode'); |
|
| 43 | |||
| 44 | 1 | $body = $this->streamFactory->createStreamFromResource($resource); |
|
| 45 | 1 | $request = $request->withBody($body); |
|
| 46 | } |
||
| 47 | |||
| 48 | 1 | return $handler->handle($request); |
|
| 49 | } |
||
| 51 |