Symfony\Component\HttpKernel\Event\KernelEvent::getRequest PHP Method

getRequest() public method

Returns the request the kernel is currently processing
public getRequest ( ) : Request
return Symfony\Component\HttpFoundation\Request
    public function getRequest()
    {
        return $this->request;
    }

Usage Example

 /**
  * Check if the user is logged in when requesting an account route, if not
  * redirect to the homepage.
  *
  * @param  Event  $event
  */
 public function checkLoggedIn(KernelEvent $event)
 {
     $user = $this->get('user.current');
     if ($user instanceof AnonymousUser and is_array($event->getRequest()->get('_route_collections')) and in_array('ms.user.account', $event->getRequest()->get('_route_collections'))) {
         $event->setResponse(new RedirectResponse('/'));
     }
 }
All Usage Examples Of Symfony\Component\HttpKernel\Event\KernelEvent::getRequest