Analyzes the current request, and saves the values for portal, language, country and segment for further usage.
public analyze ( |
||
$request | The request to analyze |
/** * 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); } }
public function testNoAnalyzerForSubRequest() { $this->getResponseEvent->isMasterRequest()->willReturn(false); $this->requestListener->onKernelRequest($this->getResponseEvent->reveal()); $this->requestAnalyzer->analyze(Argument::any())->shouldNotHaveBeenCalled(); }
public function onKernelRequest(GetResponseEvent $event) { if ($event->isMasterRequest()) { $this->requestAnalyzer->analyze($event->getRequest()); } }