Reads the expected number of files from the archive.

@param integer $expected The expected number of files.
@param integer $size     The size of the archive.

@return array The list of files.
542476
private function readFileList($expected, $size)
    {
        $files = array();
        $offset = $this->offset + $size;

        for ($i = 0; $i < $expected; $i++) {
            $file = array(
                'crc32'=> null,
                'flags' => null,
                'metadata' => array(
                    'data' => null,
                    'size' => null,
                ),
                'name' => array(
                    'data' => null,
                    'size' => null,
                ),
                'offset' => $offset,
                'size' => array(
                    'compressed' => null,
                    'uncompressed' => null,
                ),
                'time' => null,
            );

            $file['name']['size'] = $this->readLong();
            $file['name']['data'] = $this->read($file['name']['size']);
            $file['size']['uncompressed'] = $this->readLong();
            $file['time'] = $this->readLong();
            $file['size']['compressed'] = $this->readLong();
            $file['crc32'] = $this->readLong();
            $file['flags'] = $this->readLong() & self::MASK;
            $file['metadata']['size'] = $this->readLong();

            $offset += $file['size']['compressed'];
            $files[] = $file;
        }

        return $files;
    }
792565
public static function parseSize($size)
    {
        $height = null;
        $width = null;

        if (count((array) $size) == 2 || strpos($size, 'x')) {
            list($width, $height) = is_array($size) ? $size : explode('x', $size);
        } else {
            $size = (array) $size;
            $width = (int) $size[0];
        }

        return array($width,$height);
    }
436337
public function stream_read($count)
    {
        if ($this->stream_eof()) {
            return false;
        }
        $s = substr($this->data, $this->pos, $count);
        $this->pos += $count;
        return $s;
    }
209709
public function readByLine(int $size = null)
    {
        if ($this->file == null) {
            throw new Server500(new \ArrayObject(array("explain" =>
                "Cannot read file for unopened file",
                "solution" =>
                    "Please open the file with [FileListener::open] before trying to get read it.")));
        }

        if ($size === null) {
            return (fgets((($this->tempFile === null)? ($this->file) : $this->tempFile), $this->size()));
        } else {
            return (fgets((($this->tempFile === null)? ($this->file) : $this->tempFile), $size));
        }
    }
845529
public function getPortraitFile($size)
    {
        $filename = $this->filename;

        //get file extension
        $extension = explode('.', $filename);
        $extension = array_pop($extension);

        //remove extension
        $name = preg_replace('#\.[^.]*$#', '', $filename);

        $filename = $name.'_'.$size.'.'.$extension;

        return $filename;
    }
62605
protected function doRead(int $offset, int $count): string
    {
        if (($offset + $count) > $this->size) {
            $count = $this->size - $offset;
        }

        $result = '';
        for ($i = 0; $i < $count; $i++) {
            $result .= $this->content[$i + $offset] ?? ' ';
        }

        return $result;
    }
728496
public function read($size = 1024)
    {
        if ($this->driver === self::DRIVER_SOCKET) {
            return socket_read($this->sock, $size);
        } else {
            return fread($this->sock, $size);
        }
    }
984496
public function read($count)
    {
        $data = substr($this->content, $this->bytes_read, $count);
        $this->bytes_read  += $count;
        $this->lastAccessed = time();
        return $data;
    }
761649
public function filesize(Model $model, $data, $size = 5242880) {
        return $this->_validate($model, $data, 'size', array($size));
    }
155862
public function imageSpecs(string $size): array
    {
        $specs = wp_get_additional_image_sizes();

        if ($size === 'thumbnail' && !isset($specs[$size])) {
            $width        = (int) get_option('thumbnail_size_w');
            $height       = (int) get_option('thumbnail_size_h');
            $crop         = (bool) get_option('thumbnail_crop');
            return $specs = compact('width', 'height', 'crop');
        }
        return $specs = $specs[$size] ?? [];
    }
839384
public function getLogFiles($count = 20)
    {
        $files = glob(storage_path('logs/*'));
        $files = array_combine($files, array_map("filemtime", $files));
        arsort($files);

        $files = array_map('basename', array_keys($files));

        return array_slice($files, 0, $count);
    }
135706
public static function fileSize($size, $decimals = 2)
    {
        $units = [
            'B', 'KB', 'MB',
            'GB', 'TB', 'PB',
            'EB', 'ZB', 'YB'
        ];

        if ($size < 0)
        {
            throw new Exceptions\Invalid('Undefined size!');
        }

        $log     = \log($size, 1024);
        $power   = \min(\floor($log), \count($units));
        $postfix = $units[$power > 0 ? $power : 0];

        while ($power > 0 && $power--)
        {
            $size /= 1024;
        }

        return Num::format($size, $decimals) . ' ' . $postfix;
    }
1246450
public function read($length)
    {
        $streamResource = $this->getStreamResource();
        if (!is_resource($streamResource)) {
            throw new \UnexpectedValueException('Stream resource parameter must be a resource');
        }
        $streamsRead   = array($streamResource);
        $streamsWrite  = NULL;
        $streamsExcept = NULL;

        $hasDataToRead = stream_select(
            $streamsRead,
            $streamsWrite,
            $streamsExcept,
            0
        );

        if ($hasDataToRead) {
            return fread($streamResource, $length);
        }
        return false;
    }
97403
public function stream_read($count)
    {
        if ($this->stream_eof()) {
            return false;
        }

        $out = '';
        $tmp = &$this->_data[$this->_datapos];

        while ($count) {
            if (!is_resource($tmp['fp'])) {
                return false;
            }

            $curr_read = min($count, $tmp['l'] - $tmp['p']);
            $out .= fread($tmp['fp'], $curr_read);
            $count -= $curr_read;
            $this->_position += $curr_read;

            if ($this->_position == $this->_length) {
                if ($count) {
                    $this->_ateof = true;
                    break;
                } else {
                    $tmp['p'] += $curr_read;
                }
            } elseif ($count) {
                if (!isset($this->_data[++$this->_datapos])) {
                    return false;
                }
                $tmp = &$this->_data[$this->_datapos];
                rewind($tmp['fp']);
                $tmp['p'] = 0;
            } else {
                $tmp['p'] += $curr_read;
            }
        }

        return $out;
    }
306485
private function getFileList()
    {

        $count = $this->getFileCount();
        $size = $this->getSize() + 4;

        $this->seek(
            $this->offset
            + 18
            + $this->getAliasSize()
            + 4
            + $this->getMetadataSize()
        );

        return $this->readFileList($count, $size);
    }
54778
public function read($count)
    {
        // If the archive is complete, we only read the remaining buffer.
        if (!$this->isComplete) {
            if (isset($this->curVideoStream)) {
                if ($this->curVideoStream->eof()) {
                    // Stop streaming the current video.
                    $this->complete_file_stream();

                    $video = next($this->videos);
                    if ($video) {
                        // Start streaming the next video.
                        $this->startVideoStream($video);
                    } else {
                        // No video left.
                        $this->finish();
                        $this->isComplete = true;
                    }
                } else {
                    // Continue streaming the current video.
                    $this->stream_file_part($this->curVideoStream->read($count));
                }
            } else {
                // Start streaming the first video.
                $this->startVideoStream(current($this->videos));
            }
        }

        return fread($this->buffer, $count);
    }
126028
public function stream_read( $count )
    {
        $ret = substr( $this->string, $this->position, $count );
        $this->position += strlen( $ret );
        return $ret;
    }