| Conditions | 4 |
| Paths | 8 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 47 | 4 | public function createResponse(string $format, FormatterInterface $formatter, FeedInterface $feed) : ResponseInterface |
|
| 48 | { |
||
| 49 | $headers = [ |
||
| 50 | 4 | 'Content-Type' => ($format === 'json') ? 'application/json' : 'application/xhtml+xml', |
|
| 51 | 4 | 'Cache-Control' => ($this->public ? 'public' : 'private') . ", max-age={$this->maxAge}", |
|
| 52 | ]; |
||
| 53 | |||
| 54 | // Feed could have no items |
||
| 55 | 4 | if ($feed->getLastModified() instanceof \DateTime) { |
|
| 56 | 3 | $headers['Last-Modified'] = $feed->getLastModified()->format(\DateTime::RSS); |
|
| 57 | } |
||
| 58 | |||
| 59 | 4 | return new Response(200, $headers, $formatter->toString($feed)); |
|
| 60 | } |
||
| 61 | } |
||
| 62 |