RedirectHandler implements MiddlewareInterface

Hooks into the frontend request, and checks if a redirect should apply, If so, a redirect response is triggered.

Internal

Table of Contents

Interfaces

MiddlewareInterface

Properties

$eventDispatcher  : EventDispatcherInterface
$logger  : LoggerInterface
$redirectService  : RedirectService
$responseFactory  : ResponseFactoryInterface

Methods

__construct()  : mixed
process()  : ResponseInterface
buildRedirectResponse()  : ResponseInterface
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

$eventDispatcher

protected EventDispatcherInterface $eventDispatcher

$responseFactory

protected ResponseFactoryInterface $responseFactory

Methods

__construct()

public __construct(RedirectService $redirectService, EventDispatcherInterface $eventDispatcher, ResponseFactoryInterface $responseFactory, LoggerInterface $logger) : mixed
Parameters
$redirectService : RedirectService
$eventDispatcher : EventDispatcherInterface
$responseFactory : ResponseFactoryInterface
$logger : LoggerInterface

process()

public process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
$request : ServerRequestInterface
$handler : RequestHandlerInterface
Return values
ResponseInterface

buildRedirectResponse()

protected buildRedirectResponse(UriInterface $uri, array<string|int, mixed> $redirectRecord) : ResponseInterface
Parameters
$uri : UriInterface
$redirectRecord : array<string|int, mixed>
Return values
ResponseInterface

redirectUriWillRedirectToCurrentUri()

Checks if redirect uri matches current request uri.

protected redirectUriWillRedirectToCurrentUri(ServerRequestInterface $request, UriInterface $redirectUri) : bool
Parameters
$request : ServerRequestInterface
$redirectUri : UriInterface
Return values
bool

sanitizeUriForComparison()

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
Return values
UriInterface

        
On this page

Search results