RedirectHandler implements MiddlewareInterface, LoggerAwareInterface uses LoggerAwareTrait
Hooks into the frontend request, and checks if a redirect should apply, If so, a redirect response is triggered.
Table of Contents
Interfaces
- MiddlewareInterface
- LoggerAwareInterface
Properties
Methods
- __construct() : mixed
- process() : ResponseInterface
- buildRedirectResponse() : ResponseInterface
- incrementHitCount() : void
- Updates the sys_redirect's hit counter by one
- redirectUriWillRedirectToCurrentUri() : bool
- Checks if redirect uri matches current request uri.
- sanitizeUriForComparison() : UriInterface
- Strip down uri to be suitable to make valid comparison in 'redirectUriWillRedirectToCurrentUri()' if uri is pointing to itself and redirect should be processed.
Properties
$redirectService
protected
RedirectService
$redirectService
Methods
__construct()
public
__construct(RedirectService $redirectService) : mixed
Parameters
- $redirectService : RedirectService
process()
public
process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
- $request : ServerRequestInterface
- $handler : RequestHandlerInterface
Return values
ResponseInterfacebuildRedirectResponse()
protected
buildRedirectResponse(UriInterface $uri, array<string|int, mixed> $redirectRecord) : ResponseInterface
Parameters
- $uri : UriInterface
- $redirectRecord : array<string|int, mixed>
Return values
ResponseInterfaceincrementHitCount()
Updates the sys_redirect's hit counter by one
protected
incrementHitCount(array<string|int, mixed> $redirectRecord) : void
Parameters
- $redirectRecord : array<string|int, mixed>
redirectUriWillRedirectToCurrentUri()
Checks if redirect uri matches current request uri.
protected
redirectUriWillRedirectToCurrentUri(ServerRequestInterface $request, UriInterface $redirectUri) : bool
Parameters
- $request : ServerRequestInterface
- $redirectUri : UriInterface
Return values
boolsanitizeUriForComparison()
Strip down uri to be suitable to make valid comparison in 'redirectUriWillRedirectToCurrentUri()' if uri is pointing to itself and redirect should be processed.
protected
sanitizeUriForComparison(UriInterface $uri, bool $relativeCheck) : UriInterface
Parameters
- $uri : UriInterface
- $relativeCheck : bool