Paginates through audio items stored on the WeChat servers.

@param int $offset - The offset from which to start showing items.
@param int $count - The number of items to show.

@return Paginated\AudioResultSet
@throws Exception
770857
public function paginateAudio ($offset = 0, $count = 20)
    {
        $json = $this->paginate(MediaType::AUDIO, $offset, $count);
        $resultSet = [];
        
        foreach ($json->item as $item) {
            $resultSet = new Paginated\Audio($item->media_id, $item->update_time);
        }

        return new Paginated\AudioResultSet($resultSet, $json->total_count, $offset);
    }
347420
public function iterNextPage($count = 3)
    {
        if ($this->getPage() == 1 && $this->getPagesCount() >= $count * 2) {
            $count *= 2;
        }
        $pages = [];
        foreach (range(1, $count) as $i) {
            $page = $this->getPage() + $i;
            if ($page <= $this->getPagesCount()) {
                $pages[] = $page;
            }
        }

        return $pages;
    }
436337
public function stream_read($count)
    {
        if ($this->stream_eof()) {
            return false;
        }
        $s = substr($this->data, $this->pos, $count);
        $this->pos += $count;
        return $s;
    }
917411
public function stream_read($count)
    {
        $ret = substr($this->_data, $this->_pos, $count);
        $this->_pos += strlen($ret);
        return $ret;
    }
1316157
public function set_count($try, $count) {
        $this->totalcount = $this->totalcount + $count;
        $this->trycount[$try] = $count;
    }
1214632
public function up ( $count = 0 ) {
        $this->_currentPosition = array(
                                        $this->_currentPosition[0],
                                        $this->_currentPosition[1] - $count,
                                       );
        return $this;
    }
1339782
public function list(string $type, int $offset = 0, int $count = 20)
    {
        return Response::json($this->curl->post(self::LIST.$this->access_token, json_encode([
                    'type' => $type,
                    'offset' => $offset,
                    'count' => $count,
                ]
            )
        )
        );
    }
1121490
public function list($offset = 0, $count = 10, $statusList = 'CARD_STATUS_VERIFY_OK')
    {
        $params = [
            'offset' => $offset,
            'count' => $count,
            'status_list' => $statusList,
        ];

        return $this->httpPostJson('card/batchget', $params);
    }
143734
function slice ($offset = 0, $count = -1)
  {
    $this->setIterator (new LimitIterator ($this->getIterator (), $offset, $count));
    return $this;
  }
984496
public function read($count)
    {
        $data = substr($this->content, $this->bytes_read, $count);
        $this->bytes_read  += $count;
        $this->lastAccessed = time();
        return $data;
    }
724756
public function stream_read($count)
    {
        $ret = substr($this->data, $this->position, $count);
        $this->position += strlen($ret);
        return $ret;
    }
503463
public function paginateNews ($offset = 0, $count = 20)
    {
        $json = $this->paginate(MediaType::ARTICLE, $offset, $count);
        $resultSet = [];
        
        foreach ($json->item as $item) {
            $resultSet[] = $this->expandNews(
                $item->content->news_item,
                new Paginated\News($item->media_id, $item->update_time)
            );
        }

        return new Paginated\NewsResultSet($resultSet, $json->total_count, $offset);
    }
436001
public function ezCount($stat, $count = 1)
    {
        if (! isset($this->config['ez_key'])) {
            throw new Exception('StatHat EZ key not set.');
        }

        // If a prefix is set, prepend it to the stat name.
        if (! empty($this->config['prefix'])) {
            $stat = $this->config['prefix'].$stat;
        }

        $this->post('ez', ['ezkey' => $this->config['ez_key'], 'stat' => $stat, 'count' => $count]);
    }
117135
private function handle(Response $response, $count = false)
    {
        $responseData = json_decode($response->getContent(), true);

        if (!$response->isSuccessful()) {
            // @todo get better error
            throw new \RuntimeException($response->getContent());
        }

        if (true === $count) {
            switch ($responseData['kind']) {
                case 'youtube#playlistItemListResponse':
                    return (int) $responseData['pageInfo']['totalResults'];
                    break;

                default:
                    throw new \Exception('unsupported count operation');
                    break;
            }
        }

        if (isset($responseData['nextPageToken'])) {
            $this->nextPageToken = $responseData['nextPageToken'];
        } else {
            $this->nextPageToken = null;
        }
        return $responseData['items'];
    }
1115219
public function paginate(int $count)
    {
        $this->count = $count;

        $this->treatmentPerPage();
                        
        if ($this->perPage !== null) {
            $this->nbPages = ceil($this->count / $this->perPage);
        } else {
            $this->nbPages = 1;
        }

        if ($this->getP !== null && $this->getP > 0 && $this->getP <= $this->nbPages && preg_match(self::REGEX_INTEGER, $this->getP)) {
            $this->currentPage = $this->getP;
        } else {
            $this->currentPage = 1;
        }

        $this->setLimitAndSetOffset();
    }
251752
public function read($count)
    {
        if ($this->isEof()) {
            return null;
        }
        $buffer         = substr($this->buffer, $this->position, $count);
        $this->position += $count;
        return $buffer;
    }
930274
public function rewind(int $count): Content
    {
        $this->pos -= $count;
        if ($this->pos < 0) {
            $this->pos = 0;
        }

        return $this;
    }