protected function marshalPath($path): string
    {
        if ( null === $path ) {
            $path = '/';
        }

        if ( ! is_string($path) ) {
            throw new UriException(
                'Path must be a string or null'
            );
        }

        return preg_replace_callback(
            '/(?:[^'.self::$unreservedCharacters.self::$subDelimitedCharacters.'%:@\/]++|%(?![A-Fa-f0-9]{2}))/',
            function($match) {
                return rawurlencode($match[0]);
            },
            $path
        );
    }
protected function marshalPath($path): string
    {
        if ( null === $path ) {
            $path = '/';
        }

        if ( ! is_string($path) ) {
            throw new UriException(
                'Path must be a string or null'
            );
        }

        return preg_replace_callback(
            '/(?:[^'.self::$unreservedCharacters.self::$subDelimitedCharacters.'%:@\/]++|%(?![A-Fa-f0-9]{2}))/',
            function($match) {
                return rawurlencode($match[0]);
            },
            $path
        );
    }
protected function marshalPath ( $ path ) : string { if ( null === $ path ) { $ path = '/' ; } if ( ! is_string ( $ path ) ) { throw new UriException ( 'Path must be a string or null' ) ; } return preg_replace_callback ( '/(?:[^' . self :: $ unreservedCharacters . self :: $ subDelimitedCharacters . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/' , function ( $ match ) { return rawurlencode ( $ match [ 0 ] ) ; } , $ path ) ; }
marshals the path.

@param $path
@return string
@throws UriException
marshals the path .