/**
* Analyzes the current request, and saves the values for portal, localization and segment for further usage.
*
* @param Request $request The request to analyze
*
* @throws Exception\UrlMatchNotFoundException
*/
public function analyze(Request $request)
{
$url = $request->getHost() . $request->getPathInfo();
$portalInformation = $this->webspaceManager->findPortalInformationByUrl($url, $this->environment);
$this->getParameter = $request->query->all();
$this->postParameter = $request->request->all();
if ($portalInformation === null) {
throw new UrlMatchNotFoundException($request->getUri());
}
$this->setCurrentMatchType($portalInformation->getType());
$this->setCurrentRedirect($portalInformation->getRedirect());
$this->analyticsKey = $portalInformation->getAnalyticsKey();
if ($portalInformation->getType() == RequestAnalyzerInterface::MATCH_TYPE_REDIRECT) {
$this->setCurrentPortalUrl($portalInformation->getUrl());
$this->setCurrentWebspace($portalInformation->getWebspace());
return;
}
$this->setCurrentPortalUrl($portalInformation->getUrl());
$this->setCurrentLocalization($portalInformation->getLocalization());
$this->setCurrentPortal($portalInformation->getPortal());
$this->setCurrentWebspace($portalInformation->getWebspace());
$this->setCurrentSegment($portalInformation->getSegment());
$request->setLocale($portalInformation->getLocalization()->getLocalization());
list($resourceLocator, $format) = $this->getResourceLocatorFromRequest($portalInformation, $request);
// get the path and set it on the request
$this->setCurrentResourceLocator($resourceLocator);
if ($format) {
$request->setRequestFormat($format);
}
// get the resource locator prefix and set it
$this->setCurrentResourceLocatorPrefix(substr($portalInformation->getUrl(), strlen($request->getHost())));
}