@param string $file_path

@return string
557912
public function getReportingLevelForFile($file_path)
    {
        foreach ($this->custom_levels as $custom_level) {
            if ($custom_level->allows($file_path)) {
                return $custom_level->getErrorLevel();
            }
        }

        return $this->error_level;
    }
52141
public function findRealPath($file_path)
    {
        if (@file_exists($file_path)) {
            return realpath($file_path);
        }
        if (@file_exists($this->web_root_path.$file_path)) {
            return $this->web_root_path.$file_path;
        }
        return null;
    }
1341608
public function create($file_path)
    {
        $file_path_lc = strtolower($file_path);

        $storage = new FileStorage($file_path);
        self::$storage[$file_path_lc] = $storage;
        self::$new_storage[$file_path_lc] = $storage;

        return $storage;
    }
1362087
public function getURL($file_path = null)
    {
        if (!$this->base_url) {
            throw new BaseException('Unable to determine URL');
        }

        if (!$file_path) {
            return $this->base_url;
        }

        $u = $this->base_url;
        if (substr($u, -1) != '/') {
            $u .= '/';
        }

        return $u.$file_path;
    }
266572
public static function getFileName($filePath) {
        $lastIndex = strripos($filePath, DIRECTORY_SEPARATOR);
        $fileName = substr($filePath, $lastIndex + 1);
        return substr($fileName, 0, strripos($fileName, "."));
    }
386607
protected function getFileType($file_url)
    {
        $file_info = (new Client())->head($file_url);
        $file_type = $file_info->getHeader('content-type');

        if (is_array($file_type)) {
            return reset($file_type);
        }

        return $file_type;
    }
795633
public function getFilename($file_name, $rotation_index = 0)
    {
        if ($rotation_index===0) return $file_name;
        $rotation_date = date(
            $this->options['date_format'],
            time() - ($this->options['period_duration'] * $rotation_index)
        );
        return strtr(
            sprintf($this->options['filename_mask'], $file_name),
            array(
                $this->options['filename_date_tag'] => $rotation_date,
                $this->options['filename_iterator_tag'] => $rotation_index,
            )
        );
    }
434347
private function getCacheLocationForPath($file_path, $create_directory = false)
    {
        $root_cache_directory = $this->config->getCacheDirectory();

        if (!$root_cache_directory) {
            throw new \UnexpectedValueException('No cache directory defined');
        }

        $parser_cache_directory = $root_cache_directory . DIRECTORY_SEPARATOR . self::FILE_STORAGE_CACHE_DIRECTORY;

        if ($create_directory && !is_dir($parser_cache_directory)) {
            mkdir($parser_cache_directory, 0777, true);
        }

        return $parser_cache_directory
            . DIRECTORY_SEPARATOR
            . sha1($file_path)
            . ($this->config->use_igbinary ? '-igbinary' : '');
    }
1171915
private function loadFromCache($file_path)
    {
        $cache_location = $this->getCacheLocationForPath($file_path);

        if (file_exists($cache_location)) {
            if ($this->config->use_igbinary) {
                $storage = igbinary_unserialize((string)file_get_contents($cache_location));

                if ($storage instanceof FileStorage) {
                    return $storage;
                }

                return null;
            }

            $storage = unserialize((string)file_get_contents($cache_location));

            if ($storage instanceof FileStorage) {
                return $storage;
            }

            return null;
        }

        return null;
    }
1207312
public static function pathToUri(string $filepath): string
    {
        $filepath = trim(str_replace('\\', '/', $filepath), '/');
        $parts = explode('/', $filepath);
        // Don't %-encode the colon after a Windows drive letter
        $first = array_shift($parts);
        if (substr($first, -1) !== ':') {
            $first = rawurlencode($first);
        }
        $parts = array_map('rawurlencode', $parts);
        array_unshift($parts, $first);
        $filepath = implode('/', $parts);
        return 'file:///' . $filepath;
    }
303689
public function getContent($file_path)
    {
        $file = []; // 文件解析完之后的数据
        $file_path = trim($file_path);
        // 初始配置
        $file_set = [
            'file_name' => basename($file_path),
            'file_dire' => dirname($file_path),
            'file_path' => dirname($file_path). DIRECTORY_SEPARATOR . basename($file_path),
            'title'     => '',
            'date'      => date('Y-m-d'),
            'tags'      => '',
            'type'      => '',
            'author'    => '',
            'linker'    => '',
            'license'   => '',
        ];
        // 检查是否为md文件，不是的话不做后续解析
        $string = file_get_contents($file_path);
        $string = explode("---", trim($string));
        $string = array_filter($string);
        $setting = isset($string[1]) ? $string[1] : ''; // 文章配置
        unset($string[0], $string[1]);
        $content = implode($string, "---");

        // 文章配置
        $setting = explode("\n", trim($setting));
        $setting = array_filter($setting);
        foreach ($setting as $key => $v) {
            $s = explode(":", trim($v));
            $key = trim($s[0]);
            unset($s[0]);
            $value = trim( implode($s, ':') );
            if (!empty($value)) {
                $file_set[$key] = $value;
            }
        }

        // 处理文章标签
        if (isset($file_set['tags'])) {
            $file_set['tags'] = array_filter(explode(',', $file_set['tags']));
        }

        $file['setting'] = $file_set;
        $file['content'] = $content;
        return $file;
    }
591646
public function familiar($file_path)
    {
        $dirs = explode('/', $file_path);
        $new_file_root = array_pop($dirs);
        array_unshift($dirs, reset($this->subDirs));
        
        $file = new static($this->type);
        $file->subDirs = $dirs;
        $file->fileRoot = $new_file_root;
        $file->extension = $this->extension;
        return $file;
    }
747647
public function get(string $path) : string {

		if(! file_exists($path) )
			throw new FileNotFoundException($path, 200);

		return file_get_contents($path);
	}
1095367
public static function AdjustFilePathEncoding ($file_path) {
		if (\PHP_OS !== 'WINNT' && \PHP_OS !== 'WIN32') {
			return $file_path;
		}

		$internal_encoding = mb_internal_encoding();
		$file_path_encoding = mb_detect_encoding($file_path, ['UTF-8', 'SJIS-win', 'eucJP-win', 'JIS', 'ASCII'], true);

		if ($file_path_encoding === $internal_encoding) {
			return $file_path;
		}

		return mb_convert_encoding($file_path, $internal_encoding, $file_path_encoding);
	}
508913
public static function ExtractPharPath ($real_file_path) {
		$phar_file_path = $real_file_path;
		while (!file_exists($phar_file_path)) {
			if (file_exists($phar_file_path . '.phar')) {
				preg_match("@^". $phar_file_path ."(.+)@", $real_file_path, $matches);
				return 'phar://'. $phar_file_path . '.phar' . $matches[1];
			}
			$phar_file_path = dirname($phar_file_path);
		}
		return false;
	}
874096
public function getCorePath(string $filePath): string
    {
        $rootPath = $this->getRootApplicationDirectoryPathByFilePath($filePath);
        $corePath = mb_substr($filePath, 0, mb_strpos($filePath, 'src'));
        $corePath = rtrim($corePath, DIRECTORY_SEPARATOR);
        $corePath = explode(DIRECTORY_SEPARATOR, $corePath);

        array_pop($corePath);
        $corePath = implode(DIRECTORY_SEPARATOR, $corePath);

        return rtrim($corePath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
    }
574411
public function addFileToDeepScan($file_path)
    {
        $this->files_to_scan[$file_path] = $file_path;
        $this->files_to_deep_scan[$file_path] = $file_path;
    }