analyze() public method

Analyzes the current request, and saves the values for portal, language, country and segment for further usage.
public analyze ( Request $request )
$request Symfony\Component\HttpFoundation\Request The request to analyze
Beispiel #1
0
 /**
  * Analyzes the request before passing the event to the default RouterListener from symfony and validates the result
  * afterwards.
  *
  * @param GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     $request = $event->getRequest();
     // This call is required in all cases, because the default router needs our webspace information
     // Would be nice to also only call this if the _requestAnalyzer attribute is set, but it's set on the next line
     $this->requestAnalyzer->analyze($request);
     $this->baseRouteListener->onKernelRequest($event);
     if ($request->attributes->get(static::REQUEST_ANALYZER, true) !== false) {
         $this->requestAnalyzer->validate($request);
     }
 }
Beispiel #2
0
 public function testNoAnalyzerForSubRequest()
 {
     $this->getResponseEvent->isMasterRequest()->willReturn(false);
     $this->requestListener->onKernelRequest($this->getResponseEvent->reveal());
     $this->requestAnalyzer->analyze(Argument::any())->shouldNotHaveBeenCalled();
 }
Beispiel #3
0
 public function onKernelRequest(GetResponseEvent $event)
 {
     if ($event->isMasterRequest()) {
         $this->requestAnalyzer->analyze($event->getRequest());
     }
 }