| Total Complexity | 3 |
| Total Lines | 21 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 13 | final class WebControllerService |
||
| 14 | { |
||
| 15 | private ResponseFactoryInterface $responseFactory; |
||
| 16 | private UrlGeneratorInterface $urlGenerator; |
||
| 17 | |||
| 18 | public function __construct(ResponseFactoryInterface $responseFactory, UrlGeneratorInterface $urlGenerator) |
||
| 19 | { |
||
| 20 | $this->responseFactory = $responseFactory; |
||
| 21 | $this->urlGenerator = $urlGenerator; |
||
| 22 | } |
||
| 23 | |||
| 24 | public function getRedirectResponse(string $url): ResponseInterface |
||
| 25 | { |
||
| 26 | return $this->responseFactory |
||
| 27 | ->createResponse(Status::FOUND) |
||
| 28 | ->withHeader(Header::LOCATION, $this->urlGenerator->generate($url)); |
||
| 29 | } |
||
| 30 | |||
| 31 | public function getNotFoundResponse(): ResponseInterface |
||
| 34 | } |
||
| 35 | } |
||
| 36 |