public static function replaceSegment($uri, int $offset, $segment)
    {
        $uri = self::filterUri($uri);

        return self::normalizePath($uri, (new HierarchicalPath($uri->getPath()))->withSegment($offset, $segment));
    }
public static function replaceSegment($uri, int $offset, $segment)
    {
        $uri = self::filterUri($uri);

        return self::normalizePath($uri, (new HierarchicalPath($uri->getPath()))->withSegment($offset, $segment));
    }
public static function replaceSegment ( $ uri , int $ offset , $ segment ) { $ uri = self :: filterUri ( $ uri ) ; return self :: normalizePath ( $ uri , ( new HierarchicalPath ( $ uri -> getPath ( ) ) ) -> withSegment ( $ offset , $ segment ) ) ; }
Replace a segment from the URI path according its offset.

@return Psr7UriInterface|UriInterface
Replace a segment from the URI path according its offset .