public static function withBasePath(ServerRequestInterface $request, $basePath, $pathInfo = null)
    {
        $path = $request->getUri()->getPath();
        if (strpos($path, $basePath) !== 0) {
            throw new \InvalidArgumentException;
        }
        $pathInfo = is_null($pathInfo) ? substr($path, strlen($basePath)) : $pathInfo;

        return $request
            ->withAttribute(self::BASE_PATH, $basePath)
            ->withAttribute(self::PATH_INFO, $pathInfo);
    }
public static function withBasePath(ServerRequestInterface $request, $basePath, $pathInfo = null)
    {
        $path = $request->getUri()->getPath();
        if (strpos($path, $basePath) !== 0) {
            throw new \InvalidArgumentException;
        }
        $pathInfo = is_null($pathInfo) ? substr($path, strlen($basePath)) : $pathInfo;

        return $request
            ->withAttribute(self::BASE_PATH, $basePath)
            ->withAttribute(self::PATH_INFO, $pathInfo);
    }
public static function withBasePath ( ServerRequestInterface $ request , $ basePath , $ pathInfo = null ) { $ path = $ request -> getUri ( ) -> getPath ( ) ; if ( strpos ( $ path , $ basePath ) !== 0 ) { throw new \ InvalidArgumentException ; } $ pathInfo = is_null ( $ pathInfo ) ? substr ( $ path , strlen ( $ basePath ) ) : $ pathInfo ; return $ request -> withAttribute ( self :: BASE_PATH , $ basePath ) -> withAttribute ( self :: PATH_INFO , $ pathInfo ) ; }
set a base-path and path-info for matching.

@param ServerRequestInterface $request
@param string                 $basePath
@param string|null            $pathInfo
@return ServerRequestInterface
set a base - path and path - info for matching .