Zend\Stratigility\Next::stripRouteFromPath PHP Method

stripRouteFromPath() private method

Strip the route from the request path
private stripRouteFromPath ( Psr\Http\Message\RequestInterface $request, string $route ) : Psr\Http\Message\RequestInterface
$request Psr\Http\Message\RequestInterface
$route string
return Psr\Http\Message\RequestInterface
    private function stripRouteFromPath(RequestInterface $request, $route)
    {
        $this->removed = $route;
        $uri = $request->getUri();
        $path = $this->getTruncatedPath($route, $uri->getPath());
        $new = $uri->withPath($path);
        // Root path of route is treated differently
        if ($path === '/' && '/' === substr($uri->getPath(), -1)) {
            $this->removed .= '/';
        }
        return $request->withUri($new);
    }