public static function getLocalPath($path, $webDir, $hostPattern = '/(.*)+/')
    {
        if (false !== strpos($path, '://')) {
            $url = parse_url($path);

            if (isset($url['host'], $url['path'])
                    && preg_match($hostPattern, $url['host'], $matches)) {
                $path = static::getExistingPath($url['path'], $webDir, $path);
            }
        } else {
            $path = static::getExistingPath($path, $webDir);
        }

        return $path;
    }