Total Complexity | 3 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | final class JsonDataConverter implements DataConverterInterface |
||
13 | { |
||
14 | private JsonSerializer $jsonSerializer; |
||
15 | private StreamFactoryInterface $streamFactory; |
||
16 | |||
17 | public function __construct( |
||
23 | } |
||
24 | |||
25 | public function convertData($data, ResponseInterface &$response): StreamInterface |
||
26 | { |
||
27 | $content = $this->jsonSerializer->serialize($data); |
||
28 | $response = $response->withHeader('Content-Type', $this->getContentType()); |
||
29 | return $this->streamFactory->createStream($content); |
||
30 | } |
||
31 | |||
32 | protected function getContentType(): string |
||
35 | } |
||
36 | } |
||
37 |