Obtain MySQL Database Info From env file.

@param $file
@return array
550233
protected function obtainMySQLDatabaseInfoFromEnv($file)
    {
        $env = (new Loader($file))->parse()->toArray();

        if (! array_key_exists('DB_CONNECTION', $env)  || $env['DB_CONNECTION'] != 'mysql') {
            return null;
        }

        if (! array_key_exists('DB_DATABASE', $env) ||
             ! array_key_exists('DB_USERNAME', $env) ||
             ! array_key_exists('DB_PASSWORD', $env)) {
            return null;
        }

        return [
          'name' => $env['DB_DATABASE'],
          'user' => $env['DB_USERNAME'],
          'password' => $env['DB_PASSWORD'],
        ];
    }
229445
protected function getFileContents($file)
    {
        if ($file instanceof ModuleResource) {
            $path = $file->getPath();
        } else {
            $path = Director::baseFolder() . '/' . $file;
        }
        if (!file_exists($path)) {
            return null;
        }
        $content = file_get_contents($path);

        // Remove UTF-8 BOM
        if (substr($content, 0, 3) === pack("CCC", 0xef, 0xbb, 0xbf)) {
            $content = substr($content, 3);
        }

        return $content;
    }
570658
public function getVersionedQuery(string $file): string {
        $versionAppendix = (new Garp_Version())->__toString() ?: intval(microtime(true));
        return !empty($file) && substr($file, -1) !== '/'
            ? $file . '?' . $versionAppendix
            : $file;
    }
590605
protected function getImageInfo($file)
	{
		$imageInfo = getimagesize($file);

		if($imageInfo === false)
		{
			throw new RuntimeException(vsprintf('Unable to process the image [ %s ].', [$file]));
		}

		return $imageInfo;
	}
554407
public function getLocalFile($file = '') {
        #判断数据不为空
        if (empty($file)) {
            return [];
        }
        $data = [];
        foreach ($file as $key => $value) {
            $path = ROOT_DIR . $value['name'];
            if (is_file($path)) {
                #获取文件内容
                $value['content'] = encrypt(file_get_contents($path));
                $data[]           = $value;
            }
        }
        return $data;
    }
939299
protected function read($file)
    {
        $data = null;
        $key  = $file;
        $file = $this->getFileName($file);

        if ( file_exists($file))
        {
            // if cache file not expire
            if (filemtime($file) >= time())
            {
                echo "read cache<br/>";
                $data = file_get_contents($file);
                $data = ($this->base64Encode) ? base64_decode($data) : $data;
                $data = unserialize($data);
                static::$keys[$key] = true;
            }
            else
            {
                unset(static::$keys[$key]);
                unlink($file);
            }
        }

        return $data;
    }
19366
protected function _fileGetContents($file)
    {
        $result = false;
        if (!is_file($file)) {
            return false;
        }
        $f = @fopen($file, 'rb');
        if ($f) {
            if ($this->_options['file_locking']) @flock($f, LOCK_SH);
            $result = stream_get_contents($f);
            if ($this->_options['file_locking']) @flock($f, LOCK_UN);
            @fclose($f);
        }
        return $result;
    }
200207
private function getFileInfo(UploadedFile $file)
    {
        $fileManager = $this->get('tuna_cms_file.manager.file_manager');
        $filename = $fileManager->generateTmpFilename($file);

        return [
            'path' => $filename,
            'mimeType' => $file->getMimeType(),
            'originalName' => $file->getClientOriginalName(),
        ];
    }
1305722
public function getMeta($file)
    {
        $content = file_get_contents($file);

        $matches = array();
        preg_match('~<!--(.*?)-->~msi', $content, $matches);

        if (empty($matches[1])) {
            return array();
        }

        $meta = json_decode(trim($matches[1]), true);

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

        $meta += array(
            'title' => '',
            'teaser' => '',
            'weight' => 0
        );

        return $meta;
    }
1182980
public function getContents($file)
    {
        $file = $this->basePath.'/'.ltrim($file, '/\\');

        if(!file_exists($file))
            throw new \Exedra\Exception\NotFoundException("File [$file] not found");

        return file_get_contents($file);
    }
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);
        }
    }
90193
public function getCommonConfigVar($file)
    {
        $_config = [];

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

        if (file_exists($absFile)) {
            include $absFile;
        }
        return $_config;
    }
533137
public function getDiffFile($file)
    {
        $args = [
            '-r', '-p', '-m', '-M', '--no-commit-id', '--full-index', $this->revision,
            '--', $this->repository->getWikiDir().$file,
        ];

        $diff = Diff::parse($this->repository->run('diff-tree', $args));
        $diff->setRepository($this->repository);

        return $diff;
    }
1344147
private static function loadDefinitionsFromFile(string $file): array
    {
        if (!\is_file($file) || !\is_readable($file)) {
            // @codeCoverageIgnoreStart
            throw new \RuntimeException(\sprintf('"%s" must be a readable file', $file));
            // @codeCoverageIgnoreEnd
        }

        $definitions = require $file;

        if (!\is_array($definitions)) {
            throw new \RuntimeException(
                \sprintf('Definitions file should return an array. "%s" returned', \gettype($definitions))
            );
        }

        return $definitions;
    }
210444
protected function parseConfig($file)
    {
        $namespace = '';
        $directory = '';

        $config = file_get_contents($file);
        switch (pathinfo($file, PATHINFO_EXTENSION)) {
            case 'yml':
            case 'yaml':
                $config = Yaml::parse($config);
                if (isset($config['migrations_namespace'])) {
                    $namespace = $config['migrations_namespace'];
                }
                if (isset($config['migrations_directory'])) {
                    $directory = $config['migrations_directory'];
                }
                break;
            case 'xml':
                $doc = new \DOMDocument();
                $doc->loadXML($config);
                $list = $doc->getElementsByTagName('migrations-namespace');
                if ($list->length) {
                    $namespace = $list->item(0)->nodeValue;
                }
                $list = $doc->getElementsByTagName('migrations-directory');
                if ($list->length) {
                    $directory = $list->item(0)->nodeValue;
                }
                break;
        }

        return [
            'namespace' => $namespace && $namespace[0] == '\\' ? substr($namespace, 1) : $namespace,
            'directory' => $directory,
        ];
    }
336169
public function getConfigVar($file)
    {
        $_config = [];

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

        if (file_exists($absFile)) {
            include $absFile;
        }
        return $_config;
    }
754118
protected function getTemplateFiles($file)
    {
        $module_id = $this->theme;

        if (strpos($file, '|') !== false) {
            list($module_id, $file) = explode('|', $file, 2);
        } else if (gplcart_path_is_absolute($file)) {
            $template = substr($file, 0, (strrpos($file, '.')));
            return array($template, $template);
        }

        return array(
            GC_DIR_MODULE . "/$module_id/templates/$file",
            GC_DIR_MODULE . "/{$this->theme}/override/templates/$module_id/$file"
        );
    }