/**
* Returns matcher object corresponding to $siteAccessName or null if non applicable.
*
* Limitation: If the element number is > 1, we cannot predict how URI segments are expected to be built.
* So we expect "_" will be reversed to "/"
* e.g. foo_bar => foo/bar with elementNumber == 2
* Hence if number of elements is different than the element number, we report as non matched.
*
* @param string $siteAccessName
*
* @return \eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\URIElement|null
*/
public function reverseMatch($siteAccessName)
{
$elements = $this->elementNumber > 1 ? explode('_', $siteAccessName) : array($siteAccessName);
if (count($elements) !== $this->elementNumber) {
return null;
}
$pathinfo = '/' . implode('/', $elements) . '/' . ltrim($this->request->pathinfo, '/');
$this->request->setPathinfo($pathinfo);
return $this;
}