protected function formatPath(string $path): string
    {
        if ('' === $path) {
            $base_path = $this->base_uri->getPath();
            return in_array($base_path, ['', '/'], true) ? $base_path : './';
        }

        if (false === ($colon_pos = strpos($path, ':'))) {
            return $path;
        }

        $slash_pos = strpos($path, '/');
        if (false === $slash_pos || $colon_pos < $slash_pos) {
            return "./$path";
        }

        return $path;
    }
protected function formatPath(string $path): string
    {
        if ('' === $path) {
            $base_path = $this->base_uri->getPath();
            return in_array($base_path, ['', '/'], true) ? $base_path : './';
        }

        if (false === ($colon_pos = strpos($path, ':'))) {
            return $path;
        }

        $slash_pos = strpos($path, '/');
        if (false === $slash_pos || $colon_pos < $slash_pos) {
            return "./$path";
        }

        return $path;
    }
protected function formatPath ( string $ path ) : string { if ( '' === $ path ) { $ base_path = $ this -> base_uri -> getPath ( ) ; return in_array ( $ base_path , [ '' , '/' ] , true ) ? $ base_path : './' ; } if ( false === ( $ colon_pos = strpos ( $ path , ':' ) ) ) { return $ path ; } $ slash_pos = strpos ( $ path , '/' ) ; if ( false === $ slash_pos || $ colon_pos < $ slash_pos ) { return "./$path" ; } return $ path ; }
Formatting the path to keep a valid URI

@param string $path

@return string
Formatting the path to keep a valid URI