public static function addBasepath($uri, $path)
    {
        self::filterUri($uri);
        $currentpath = $uri->getPath();
        if ('' !== $currentpath && '/' !== $currentpath[0]) {
            $currentpath = '/'.$currentpath;
        }

        $path = (new HierarchicalPath($path))->withLeadingSlash();
        if (0 === strpos($currentpath, (string) $path)) {
            return $uri->withPath($currentpath);
        }

        return $uri->withPath((string) $path->append($currentpath));
    }
public static function addBasepath($uri, $path)
    {
        self::filterUri($uri);
        $currentpath = $uri->getPath();
        if ('' !== $currentpath && '/' !== $currentpath[0]) {
            $currentpath = '/'.$currentpath;
        }

        $path = (new HierarchicalPath($path))->withLeadingSlash();
        if (0 === strpos($currentpath, (string) $path)) {
            return $uri->withPath($currentpath);
        }

        return $uri->withPath((string) $path->append($currentpath));
    }
public static function addBasepath ( $ uri , $ path ) { self :: filterUri ( $ uri ) ; $ currentpath = $ uri -> getPath ( ) ; if ( '' !== $ currentpath && '/' !== $ currentpath [ 0 ] ) { $ currentpath = '/' . $ currentpath ; } $ path = ( new HierarchicalPath ( $ path ) ) -> withLeadingSlash ( ) ; if ( 0 === strpos ( $ currentpath , ( string ) $ path ) ) { return $ uri -> withPath ( $ currentpath ) ; } return $ uri -> withPath ( ( string ) $ path -> append ( $ currentpath ) ) ; }
Add a new basepath to the URI path.

@return Psr7UriInterface|UriInterface
Add a new basepath to the URI path .