public function onKernelRequest(GetResponseEvent $event)
    {
        $isRestRequest = true;

        if (!$this->hasRestPrefix($event->getRequest())) {
            $isRestRequest = false;
        }

        $event->getRequest()->attributes->set('is_rest_request', $isRestRequest);
    }
public function onKernelRequest(GetResponseEvent $event)
    {
        $isRestRequest = true;

        if (!$this->hasRestPrefix($event->getRequest())) {
            $isRestRequest = false;
        }

        $event->getRequest()->attributes->set('is_rest_request', $isRestRequest);
    }
public function onKernelRequest ( GetResponseEvent $ event ) { $ isRestRequest = true ; if ( ! $ this -> hasRestPrefix ( $ event -> getRequest ( ) ) ) { $ isRestRequest = false ; } $ event -> getRequest ( ) -> attributes -> set ( 'is_rest_request' , $ isRestRequest ) ; }
If the request is a REST one, sets the is_rest_request request attribute.

@param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
If the request is a REST one sets the is_rest_request request attribute .