| Total Complexity | 2 | 
| Total Lines | 22 | 
| Duplicated Lines | 0 % | 
| Changes | 2 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 11 | final class JsonResponseFormatter implements ResponseFormatterInterface  | 
            ||
| 12 | { | 
            ||
| 13 | /**  | 
            ||
| 14 | * @var string the Content-Type header for the response  | 
            ||
| 15 | */  | 
            ||
| 16 | private string $contentType = 'application/json';  | 
            ||
| 17 | |||
| 18 | private int $options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;  | 
            ||
| 19 | |||
| 20 | public function format(WebResponse $webResponse): ResponseInterface  | 
            ||
| 21 |     { | 
            ||
| 22 | $jsonSerializer = new JsonSerializer($this->options);  | 
            ||
| 23 | $content = $jsonSerializer->serialize($webResponse->getData());  | 
            ||
| 24 | $response = $webResponse->getResponse();  | 
            ||
| 25 | $response->getBody()->write($content);  | 
            ||
| 26 | |||
| 27 |         return $response->withHeader('Content-Type', $this->contentType); | 
            ||
| 28 | }  | 
            ||
| 29 | |||
| 30 | public function setOptions(int $options): void  | 
            ||
| 33 | }  | 
            ||
| 34 | }  | 
            ||
| 35 |