class RedirectMiddleware in Opigno dashboard 3.x
Executes redirect before the main kernel takes over the request.
Hierarchy
- class \Drupal\opigno_dashboard\RedirectMiddleware implements \Symfony\Component\HttpKernel\HttpKernelInterface
Expanded class hierarchy of RedirectMiddleware
1 string reference to 'RedirectMiddleware'
1 service uses RedirectMiddleware
File
- src/
RedirectMiddleware.php, line 15
Namespace
Drupal\opigno_dashboardView source
class RedirectMiddleware implements HttpKernelInterface {
/**
* The wrapped HTTP kernel.
*
* @var \Symfony\Component\HttpKernel\HttpKernelInterface
*/
protected $httpKernel;
/**
* The redirect URL.
*
* @var \Symfony\Component\HttpFoundation\RedirectResponse
*/
protected $redirectResponse;
/**
* Constructs a RedirectMiddleware
* object.
*
* @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel
* The decorated kernel.
*/
public function __construct(HttpKernelInterface $http_kernel) {
$this->httpKernel = $http_kernel;
}
/**
* {@inheritdoc}
*/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
$response = $this->httpKernel
->handle($request, $type, $catch);
return $this->redirectResponse ?: $response;
}
/**
* Stores the requested redirect response.
*
* @param \Symfony\Component\HttpFoundation\RedirectResponse|null $redirectResponse
* Redirect response.
*/
public function setRedirectResponse(?RedirectResponse $redirectResponse) {
$this->redirectResponse = $redirectResponse;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RedirectMiddleware:: |
protected | property | The wrapped HTTP kernel. | |
RedirectMiddleware:: |
protected | property | The redirect URL. | |
RedirectMiddleware:: |
public | function | ||
RedirectMiddleware:: |
public | function | Stores the requested redirect response. | |
RedirectMiddleware:: |
public | function | Constructs a RedirectMiddleware object. |