/**
* {@inheritdoc}
*/
public function process(Request $request, RequestAttributes $requestAttributes)
{
$url = rtrim(sprintf('%s%s', $request->getHost(), $request->getRequestUri()), '/');
if (substr($url, -5, 5) === '.html') {
$url = substr($url, 0, -5);
}
$portalInformations = $this->webspaceManager->findPortalInformationsByUrl($url, $this->environment);
if (count($portalInformations) === 0) {
return new RequestAttributes();
}
/** @var PortalInformation[] $portalInformations */
$portalInformations = array_filter($portalInformations, function (PortalInformation $portalInformation) {
return $portalInformation->getType() === RequestAnalyzer::MATCH_TYPE_WILDCARD;
});
foreach ($portalInformations as $portalInformation) {
if (!$portalInformation->getWebspace()) {
continue;
}
if (null !== ($attributes = $this->matchCustomUrl($url, $portalInformation, $request))) {
return new RequestAttributes($attributes);
}
}
return new RequestAttributes();
}