Reads the file and unserializes it.
@param string $indexFilepath
@return array
969804
private function loadIndexFile(string $indexFilepath): array
    {
        $this->status = IndexInterface::STATUS_LOADED;
        return \unserialize(\file_get_contents($indexFilepath));
    }
96278
public function readStream($path)
    {
        try {
            return [
                'stream' => $this->api->content($path),
                'path' => $path,
            ];
        } catch (\Exception $e) {
            return false;
        }
    }
1172903
public function openFileAsArray(string $filepath):array
    {
        if ($filepath == $this->filepath && $this->file != null) {
            return ($this->file);
        }

        if (!file_exists($filepath)) {
            Server::create($filepath, 'file');
        }

        if (!is_readable($filepath)) {
            throw new Server500(new \ArrayObject(array("explain" =>
                "Cannot open file $filepath : File not readable",
                "solution" => "Please set the readable permission")));
        }

        $this->perm = null;
        $this->filepath = $filepath;
        $this->file = file($filepath);

        if (!is_array($this->file)) {
            throw new Server500(new \ArrayObject(array("explain" =>
                "Invalid file array for $filepath",
                "solution" =>
                    "Use FileListener::open to open a file resource.")));
        }

        return ($this->file);
    }
406165
public function loadFile($filePath)
    {
        $retriever = new UriRetriever();

        try {
            $json = \json_encode($retriever->retrieve('file://' . $filePath));
        } catch (JsonDecodingException $exception) {
            throw new InvalidJsonException($exception->getCode());
        }

        return $json;
    }
1338210
public function read($path)
    {
        $contents = $this->client->getObject($this->bucket, $path);

        if ($contents != null) {
            $res = ['path' => $path, 'contents' => $contents];

            return $res;
        }

        return false;
    }
1020809
public function getFile($path = '')
    {
        $response = $this->sendRequest('GET', $path);

        $result = [];
        foreach ($response->getHeaders() as $key => $value) {
            $result['headers'][strtolower($key)] = $value[0];
        }
        $result['body'] = $response->getBody();
        return $result;
    }
488949
public function readStream($path)
    {
        $location = $this->applyPathPrefix($path);
        $resource = ($this->ossClient->isUseSSL() ? 'https://' : 'http://') . $this->bucket . '.' . $this->endpoint . '/' . $location;
        return [
            'stream' => $resource = fopen($resource, 'r')
        ];
    }
534181
public static function decodeFromFile($path)
    {
        if (!is_file($path)) {
            throw new \Exception("File does not exist: {$path}");
        }

        $string = file_get_contents($path);

        if ($string === false) {
            throw new \Exception("Failed to read the file: {$path}");
        }

        if (!$string) {
            return [];
        }

        $array = json_decode($string, true);

        static::checkLastError();

        return $array;
    }
66766
public function readFile($filePath = null, array $options = [])
    {
        $items = parse_ini_file(
            $filePath,
            (empty($options)
                ? true
                : $options[ 'sections' ])
        );

        $this->merge($items);

        return $items;
    }
622218
private function lsLegacy(string $path) : array
    {
        $list = [];
        foreach ($this->nlist($path) as $name) {
            $type   = $this->isDir($name) ? 'dir' : 'file';
            $size   = $this->size($name);
            $mtime  = $this->mdtm($name);

            if ($mtime == -1) {
                throw new RuntimeException('FTP server doesnt support \'ftp_mdtm\'');
            }

            $list[] = new File(['name' => $name, 'modify' => $mtime, 'type' => $type, 'size' => $size]);
        }
        return $list;
    }
242707
public function ls(string $path): array
    {
        $files = [];
        $d = dir($path);
        while (false !== ($entry = $d->read())) {
            if (in_array($entry, ['.', '..'], true)) {
                continue;
            }
            $entryPath = $path . $entry;
            if (is_dir($entryPath)) {
                foreach ($this->ls($entryPath . DIRECTORY_SEPARATOR) as $entryPath) {
                    $files[] = $entryPath;
                }
                continue;
            }
            if (!is_file($entryPath)) {
                continue;
            }
            $files[] = $entryPath;
        }
        $d->close();

        return $files;
    }
57668
public function readFile($filePath = null, array $options = [])
    {
        $filePath = empty($filePath)
            ? $this->filePath
            : $filePath;


        $result = [];

        if (extension_loaded('zip')) {
            if ($zipHandle = zip_open($filePath)) {
                while ($zipContent = zip_read($zipHandle)) {
                    $result[] = zip_entry_name($zipContent);
                }

                zip_close($zipHandle);
            }
        }

        return $result;
    }
1265386
public function readStream($path) {
        $mapping = $this->mapper->get($path);

        if (!$mapping) {
            return false;
        }

        try {
            $file = $this->client->get($mapping['fid']);

            if (!$file) {
                return false;
            }

            return [
                'stream' => $file
            ];
        } catch (SeaweedFSException $e) {
            return false;
        }
    }
192424
protected static function readJsonFile(string $jsonFilePath)
    {
        if (!file_exists($jsonFilePath)) {
            throw new Exception(
                'File '.$jsonFilePath.' not found.',
                self::ERR_FILE_NOT_FOUND
            );
        }

        $infos = json_decode(file_get_contents($jsonFilePath));
        if ($infos === null) {
            throw new Exception(
                json_last_error_msg(),
                self::ERR_JSON_PARSE
            );
        }

        return $infos;
    }
349834
private function ls72(string $path) : array
    {
        $list = [];
        foreach ($this->mlsd($path) as $fileInfo) {
            $list[] = new File($fileInfo);
        }
        return $list;
    }
40818
private function loadFile($path)
    {
        if (file_exists($path)) {
            return $this->loadJsonFile($path);
        }

        $dirs = $this->paths();
        if (empty($dirs)) {
            return null;
        }

        $data = [];
        $dirs = array_reverse($dirs);
        foreach ($dirs as $dir) {
            $file = $dir.DIRECTORY_SEPARATOR.$path;
            if (file_exists($file)) {
                $data = array_replace_recursive($data, $this->loadJsonFile($file));
            }
        }

        if (empty($data)) {
            return null;
        }

        return $data;
    }
799391
public function readStream($path)
    {
        //获得一个临时文件
        $tmpfname       = FileFunction::getTmpFile();

        file_put_contents($tmpfname, file_get_contents($this->applyPathPrefix($path)) );

        $handle = fopen($tmpfname, 'r');

        //删除临时文件
        FileFunction::deleteTmpFile($tmpfname);

        return ['stream' => $handle];
    }