for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace App\Http\Service;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ResponseInterface;
use Yiisoft\Http\Header;
use Yiisoft\Http\Status;
use Yiisoft\Router\UrlGeneratorInterface;
final class WebControllerService
{
public function __construct(
private ResponseFactoryInterface $responseFactory,
private UrlGeneratorInterface $urlGenerator
) {
}
public function getRedirectResponse(string $url): ResponseInterface
return $this->responseFactory
->createResponse(Status::FOUND)
->withHeader(Header::LOCATION, $this->urlGenerator->generate($url));
public function getNotFoundResponse(): ResponseInterface
->createResponse(Status::NOT_FOUND);