src/Uri.php
private function normalizePath($path)
    {
        if (!is_string($path) && !method_exists($path, '__toString')) {
            throw new InvalidArgumentException('Uri path must be a string');
        }

        $path = $this->urlEncode($path);

        if (empty($path)) {
            return '';
        }

        if ($path[0] !== '/') {
            return $path;
        }

        // Ensure only one leading slash
        return '/' . ltrim($path, '/');
    }
private function normalizePath($path)
    {
        if (!is_string($path) && !method_exists($path, '__toString')) {
            throw new InvalidArgumentException('Uri path must be a string');
        }

        $path = $this->urlEncode($path);

        if (empty($path)) {
            return '';
        }

        if ($path[0] !== '/') {
            return $path;
        }

        // Ensure only one leading slash
        return '/' . ltrim($path, '/');
    }
private function normalizePath ( $ path ) { if ( ! is_string ( $ path ) && ! method_exists ( $ path , '__toString' ) ) { throw new InvalidArgumentException ( 'Uri path must be a string' ) ; } $ path = $ this -> urlEncode ( $ path ) ; if ( empty ( $ path ) ) { return '' ; } if ( $ path [ 0 ] !== '/' ) { return $ path ; } // Ensure only one leading slash return '/' . ltrim ( $ path , '/' ) ; }
Normalize path part of Uri and ensure it is properly encoded..

@param string $path Raw Uri path.

@return string Normalized Uri path

@throws InvalidArgumentException If the Uri scheme is not a string.
Normalize path part of Uri and ensure it is properly encoded ..