Update ShortUrlRedirectionBuilder to accept a request object instead of a raw query array

This commit is contained in:
Alejandro Celaya
2023-01-21 10:37:12 +01:00
parent c1b7c6ba6c
commit 237fb95b4b
7 changed files with 30 additions and 11 deletions

View File

@@ -18,15 +18,15 @@ class RedirectAction extends AbstractTrackingAction implements StatusCodeInterfa
public function __construct(
ShortUrlResolverInterface $urlResolver,
RequestTrackerInterface $requestTracker,
private ShortUrlRedirectionBuilderInterface $redirectionBuilder,
private RedirectResponseHelperInterface $redirectResponseHelper,
private readonly ShortUrlRedirectionBuilderInterface $redirectionBuilder,
private readonly RedirectResponseHelperInterface $redirectResponseHelper,
) {
parent::__construct($urlResolver, $requestTracker);
}
protected function createSuccessResp(ShortUrl $shortUrl, ServerRequestInterface $request): Response
{
$longUrl = $this->redirectionBuilder->buildShortUrlRedirect($shortUrl, $request->getQueryParams());
$longUrl = $this->redirectionBuilder->buildShortUrlRedirect($shortUrl, $request);
return $this->redirectResponseHelper->buildRedirectResponse($longUrl);
}
}