获取配置文件的变量
@param string $file
@return array
336169
public function getConfigVar($file)
    {
        $_config = [];

        $absFile = $this->appPath . 'config/' . $this->appStatus . '/' . $file . '.cfg.php';

        if (file_exists($absFile)) {
            include $absFile;
        }
        return $_config;
    }
870652
public function findByFile($file)
    {
        if ($file instanceof File) {
            $file = $file->getFileID();
        }

        return $this->findBy([
            'file_id' => $file
        ]);
    }
903942
function readFile($file)
	{
		$fh = @fopen($file, 'r');

		$lines = false;
		if ($fh !== false) {
			$lines = array();
			while (!feof($fh)) {
				$lines[] = fgets($fh);
			}
			fclose($fh);
		}
		return $lines;
	}
814024
protected function _getMethods(File $file) {
		$methods = [];
		$currentIndex = 0;
		while (true) {
			$methodIndex = $file->findNext(T_FUNCTION, $currentIndex);
			if (!$methodIndex) {
				break;
			}
			$methods[$methodIndex] = $this->_parseMethod($file, $methodIndex);

			$currentIndex = $methodIndex + 1;
		}

		return $methods;
	}
1329562
public function read($file)
    {
        $fp = fopen($file, 'r+');

        $contents = '';

        while ($part = fread($fp, 1024)) {
            $contents .= $part;
        }

        if (null !== $fp) {
            fclose($fp);
        }

        return $contents;
    }
1288609
public static function getClassesFromFile($file)
    {
        $php = \File::get($file);
        $classes = array();
        $tokens = token_get_all($php);
        $count = count($tokens);
        for ($i = 2; $i < $count; $i++) {
            if ($tokens[$i - 2][0] == T_CLASS
                && $tokens[$i - 1][0] == T_WHITESPACE
                && $tokens[$i][0] == T_STRING
            ) {
                $class_name = $tokens[$i][1];
                $namespace = self::getNamespace($tokens);
                $classes[] = $namespace . "\\" . $class_name;
            }
        }
        return $classes;
    }
41740
public function loadFile($file)
    {
        $openfile = @fopen($file, "rb") or die("loadFile: Error opening file '{$file}'.");
        $contents = @fread($openfile, filesize($file)) or die("loadFile: Error reading data from file '{$file}'.");
        @fclose($openfile);
        return $contents;
    }
955994
public function parse(string $file): array
    {
        if (false === file_exists($file)) {
            throw InvalidArgumentExceptionFactory::createForFileCouldNotBeFound($file);
        }

        try {
            $data = json_decode(file_get_contents($file), true);

            if (null === $data) {
                throw ParseExceptionFactory::createForInvalidJson($file);
            }

            return $data;
        } catch (\Exception $exception) {
            if ($exception instanceof UnparsableFileException) {
                throw $exception;
            }

            throw ParseExceptionFactory::createForUnparsableFile($file, 0, $exception);
        }
    }
1339081
public static function extractFromFile($file)
    {
        $contents = file_get_contents($file->originalFilePath());
        
        preg_match(self::HEADER_PATTERN, $contents, $m);
        if (!$m) {
            return [[], $contents];
        }
        
        unset($contents);
        $lines      = file($file->originalFilePath(), FILE_IGNORE_NEW_LINES);
        $directives = [];
        
        foreach (preg_split('/\v/', $m[0]) as $lineNum => $line) {
            if (preg_match(self::DIRECTIVE_PATTERN, $line, $m)) {
                $dirValue = array_filter(explode(' ', $m[1]));
                $directives[] = [
                    'command'  => $dirValue[0],
                    'argument' => isset($dirValue[1]) ? $dirValue[1] : null,
                    'line'     => $lineNum + 1
                ];
                
                unset($lines[$lineNum]);
            }
        }
        
        return [$directives, implode("\n", $lines)];
    }
898978
public function getFilename($file)
    {
        // 获取文件的后缀名，因图片从剪贴板里黏贴时后缀名为空，所以此处确保后缀一直存在
        $this->extension = strtolower($file->getClientOriginalExtension()) ?: 'png';

        $randomName = str_random($this->randomLength);

        if ($this->filename) {
            return $this->filename . $this->extension;
        }

        if ($this->filePrefix) {
            return $this->filePrefix . '_' . $randomName . '.' . $this->extension;
        }

        return $randomName . '.' . $this->extension;
    }
442404
protected function getYamlAsArray($file)
    {
        if(file_exists($file)){
            $content = Yaml::parse(file_get_contents($file));
            $result  = array();
            $this->a2k($result, $content, '');

            return $result;
        }else{
            return array();
        }
    }
576186
protected function getInfo($file)
    {
        $attributes = Json::make($path = $file->getRealPath())->toArray();

        $attributes['path'] = dirname($path);

        return $attributes;
    }
1031285
protected function read(string $file):array{

		if(!is_readable($file) || !is_file($file)){
			throw new \Exception('invalid file: '.$file);
		}

		// Read file into an array of lines with auto-detected line endings
		$autodetect = ini_get('auto_detect_line_endings');
		ini_set('auto_detect_line_endings', '1');
		$lines = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
		ini_set('auto_detect_line_endings', $autodetect);

		if(!is_array($lines) || empty($lines)){
			throw new \Exception('error while reading file: '.$file);
		}

		return array_map('trim', $lines);
	}
490732
private function getTranslationArrayFromFile($file)
    {
        $extension = pathinfo($file, PATHINFO_EXTENSION);
        switch ($extension) {
            default:
                return [];
            case 'php':
                $loader = new Loader\PhpArrayTranslationsLoader($file);
                break;
        }

        return $loader->getTranslationArray();
    }
1017421
public static function getFile( $file ) {
		$file = Storage::getFile( Route::DOCUMENT_ROOT() . 'app/config/' . $file . '.json' );
		$out  = Parser::json( $file );

		return $out;
	}
187719
public function parseFile($file)
    {
        $bundleConfig = Yaml::parse(file_get_contents(realpath($file)));

        if (!is_array($bundleConfig)) {
            return array();
        }

        return $bundleConfig;
    }
674980
private static function getLinks(string $file): array
    {
        $links    = [];
        $contents = (string)file_get_contents($file);
        if (false !== preg_match_all(
            '/\[(.+?)\].*?\((.+?)\)/',
            $contents,
            $matches,
            PREG_SET_ORDER
        )) {
            $links = array_merge($links, $matches);
        }

        return $links;
    }