eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Map\URI::analyseURI PHP Method

analyseURI() public method

Fixes up $uri to remove the siteaccess part, if needed.
public analyseURI ( string $uri ) : string
$uri string The original URI
return string
    public function analyseURI($uri)
    {
        if (($siteaccessPart = "/{$this->key}") === $uri) {
            return '/';
        }
        return substr($uri, strlen($siteaccessPart));
    }

Usage Example

 /**
  * @param string $uri
  * @param string $expectedFixedUpURI
  *
  * @dataProvider fixupURIProvider
  */
 public function testAnalyseURI($uri, $expectedFixedUpURI)
 {
     $matcher = new URIMapMatcher(array());
     $matcher->setRequest(new SimplifiedRequest(array('pathinfo' => $uri)));
     $this->assertSame($expectedFixedUpURI, $matcher->analyseURI($uri));
     // Unserialized matcher should have the same behavior
     $unserializedMatcher = unserialize(serialize($matcher));
     $this->assertSame($expectedFixedUpURI, $unserializedMatcher->analyseURI($uri));
 }
All Usage Examples Of eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Map\URI::analyseURI