extensions/felixfbecker.php-intellisense-0.0.12/vendor/felixfbecker/language-server/src/utils.php
/**
 * Transforms an absolute file path into a URI as used by the language server protocol.
 *
 * @param string $filepath
 * @return string
 */
Transforms an absolute file path into a URI as used by the language server protocol.
@param string $filepath
@return string
Transforms an absolute file path into a URI as used by the language server protocol . @param string $filepath @return string
function pathToUri(string $filepath): string
{
    $filepath = trim(str_replace('\\', '/', $filepath), '/');
    $parts = explode('/', $filepath);
    $first = array_shift($parts);
    if (substr($first, -1) !== ':') {
        $first = urlencode($first);
    }
    $parts = array_map('rawurlencode', $parts);
    array_unshift($parts, $first);
    $filepath = implode('/', $parts);
    return 'file:///' . $filepath;
}
function pathToUri ( string $ filepath ) : string { $ filepath = trim ( str_replace ( '\\' , '/' , $ filepath ) , '/' ) ; $ parts = explode ( '/' , $ filepath ) ; $ first = array_shift ( $ parts ) ; if ( substr ( $ first , - 1 ) !== ':' ) { $ first = urlencode ( $ first ) ; } $ parts = array_map ( 'rawurlencode' , $ parts ) ; array_unshift ( $ parts , $ first ) ; $ filepath = implode ( '/' , $ parts ) ; return 'file:///' . $ filepath ; }
Transforms an absolute file path into a URI as used by the language server protocol.
Transforms an absolute file path into a URI as used by the language server protocol .
// Don't %-encode the colon after a Windows drive letter