extensions/felixfbecker.php-intellisense-0.0.12/vendor/felixfbecker/language-server/src/utils.php
/**
 * Transforms URI into file path
 *
 * @param string $uri
 * @return string
 */
Transforms URI into file path
@param string $uri
@return string
Transforms URI into file path @param string $uri @return string
function uriToPath(string $uri)
{
    $fragments = parse_url($uri);
    if ($fragments === null || !isset($fragments['scheme']) || $fragments['scheme'] !== 'file') {
        throw new InvalidArgumentException("Not a valid file URI: $uri");
    }
    $filepath = urldecode($fragments['path']);
    if (strpos($filepath, ':') !== false) {
        if ($filepath[0] === '/') {
            $filepath = substr($filepath, 1);
        }
        $filepath = str_replace('/', '\\', $filepath);
    }
    return $filepath;
}
function uriToPath ( string $ uri ) { $ fragments = parse_url ( $ uri ) ; if ( $ fragments === null || ! isset ( $ fragments [ 'scheme' ] ) || $ fragments [ 'scheme' ] !== 'file' ) { throw new InvalidArgumentException ( " Not a valid file URI:  $ uri " ) ; } $ filepath = urldecode ( $ fragments [ 'path' ] ) ; if ( strpos ( $ filepath , ':' ) !== false ) { if ( $ filepath [ 0 ] === '/' ) { $ filepath = substr ( $ filepath , 1 ) ; } $ filepath = str_replace ( '/' , '\\' , $ filepath ) ; } return $ filepath ; }
Transforms URI into file path
 @param string $uri
 @return string
Transforms URI into file path @param string $uri @return string