获取素材列表
@param string $type
@param int $offset
@param int $count
@return array
@throws Exception
969110
public function mediaList($type, $offset = 0, $count = 20) {
        return $this->getMediaList()->parameters([
            'type' => $type,
            'offset' => $offset,
            'count' => $count
        ])->json();
    }
133160
public function lists($offset = 0, $count = 10, $statusList = array())
    {
        $params = array(
            'offset' => $offset,
            'count' => $count,
            'status_list' => $statusList,
        );

        $result = $this->http->jsonPost(self::API_LIST, $params);

        return $result['card_id_list'];
    }
94976
private function readMoWords($fp, $offset, $count, $pack)
    {
        fseek($fp, $offset);

        return unpack($pack . $count, fread($fp, $count * 4));
    }
1316157
public function set_count($try, $count) {
        $this->totalcount = $this->totalcount + $count;
        $this->trycount[$try] = $count;
    }
425685
public function stream_read($count) {
    assert(isset($this->client));
    return $this->client->read($count);
  }
1348150
public function getCellsList($offset, $count)
    {
        //check whether workshett name is set or not
        if ($this->worksheetName == '')
            throw new Exception('Worksheet name not specified');
        $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
            '/worksheets/' . $this->worksheetName . '/cells?offset=' .
            $offset . '&count=' . $count;
        $signedURI = Utils::sign($strURI);
        $responseStream = Utils::processCommand($signedURI, 'GET', '', '');
        $json = json_decode($responseStream);
        $listCells = array();
        foreach ($json->Cells->CellList as $cell) {
            $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
                '/worksheets/' . $this->worksheetName . '/cells' . $cell->link->Href;
            $signedURI = Utils::sign($strURI);
            $responseStream = Utils::processCommand($signedURI, 'GET', '', '');
            $json = json_decode($responseStream);
            array_push($listCells, $json->Cell);
        }
        return $listCells;

    }
257879
public function spop($key, $count = null) {
        $params = [$key];
        if ($count) {
            $params[] = $count;
        }
        return $this->returnCommand(['SPOP'], $key, $params);
    }
1135464
final public function fetchAll($sql, $type = \PDO::FETCH_ASSOC)
    {
        if (!$this->DB) {
            throw  new Exception('您还没有连接数据库', Exception::CODE_DATABASE_ERROR);
        }
        $sth = $this->DB->query($sql);
        $this->lastQueryAt = time();
        return $this->DB->fetchAll($type);
    }
254068
public function batchget($offset = 0, $count = 10, $status_list = 'CARD_STATUS_VERIFY_OK')
    {
        if (!is_numeric($offset) || $offset < 0) {
            $this->setError('offset 参数不正确');

            return false;
        }

        if (!is_numeric($count) || $count < 0 || $count > 50) {
            $this->setError('count 参数不正确');

            return false;
        }

        $queryStr                = [];
        $queryStr['offset']      = $offset;
        $queryStr['count']       = $count;
        $queryStr['status_list'] = $status_list;

        $this->apitype = 'card';
        $this->module  = 'batchget';
        $res           = $this->_post('', $queryStr);

        return $res;
    }
1330227
public function offset($count)
    {
        if (count($this->models) < $count) {
            return $this->models[$count];
        }
        return null;
    }
144796
function limit( $count, $offset = null ) {

        if ( $this->parent_ ) {

            throw new \LogicException( 'Cannot limit referenced result' );

        }

        $clone = clone $this;

        $clone->limitCount = $count;
        $clone->limitOffset = $offset;

        return $clone;

    }
1166803
public function setCount(int $count, string $type = self::INFO): void
	{
		if ($count > 0) {
			switch ($type) {
				default:
					throw new InvalidArgumentException("Wrong argument 'type'");
				case self::INFO:
				case self::WARNING:
					break;
			}
			$this->count = $count;
			$this->type = $type;
		}
	}
785332
public function limit( $count = null ) {
			
			if ( null === $count || is_int( $count ) ) {
			
				if ( null !== $count && $count >= 0 ) {
					
					return $count === $this->len
						? $this
						: new static( array_slice( $this->items, 0, $count ) );
				
				} else
				if ( $many === null || $many === -1 ) {
				
					return $this;
				
				} else {
				
					throw new \browserfs\Exception('Invalid argument $count: Expected int[-1..length] | null' );
				
				}
			} else {

				throw new \browserfs\Exception('Invalid argument $count: Expected int[-1..length] | null');
			
			}

		}
1323769
public function addToCounter($eventType, $count)
    {
        if (!isset($this->totalEvents[$eventType])) {
            $this->totalEvents[$eventType] = 0;
        }

        if (is_array($count)) {
            if (isset($count['total'])) {
                $this->totalEvents[$eventType] += $count['total'];
            } elseif ($this->isEngagementCount() && $this->groupUnit) {
                // Group counts across events by unit
                foreach ($count as $key => $data) {
                    if (!isset($this->totalEventsByUnit[$key])) {
                        $this->totalEventsByUnit[$key] = 0;
                    }
                    $this->totalEventsByUnit[$key] += (int) $data;
                    $this->totalEvents[$eventType] += (int) $data;
                }
            } else {
                $this->totalEvents[$eventType] = array_sum($count);
            }
        } else {
            $this->totalEvents[$eventType] += (int) $count;
        }
    }
157934
public function paginateImages ($offset = 0, $count = 20)
    {
        $json = $this->paginate(MediaType::IMAGE, $offset, $count);
        $resultSet = [];
        
        foreach ($json->item as $item) {
            $image = new Paginated\Image($item->media_id, $item->name, $item->update_time);
            
            if (isset($item->url) && strlen($item->url) > 0) {
                $image = $image->withURL($item->url);
            }
            
            $resultSet[] = $image;
        }

        return new Paginated\ImageResultSet($resultSet, $json->total_count, $offset);
    }
1204635
public static function calculateOffset($count, $limit, $comment = null) {

		$order = self::getCommentsSort();
		$style = self::getLoadStyle();

		if ($comment instanceof Comment) {
			$thread = new Thread($comment);
			$offset = $thread->getOffset($limit, $order);
		} else if (($order == 'time_created::asc' && $style == 'load_older') || ($order == 'time_created::desc' && $style == 'load_newer')) {
			// show last page
			$offset = $count - $limit;
			if ($offset < 0) {
				$offset = 0;
			}
		} else {
			// show first page
			$offset = 0;
		}

		return (int) $offset;
	}
762253
public function getBatchCards($offset = 0, $count = 50)
    {
        $result = $this->httpPost(static::WECHAT_GET_BATCH_CARD_URL . 'access_token=' . $this->getAccessToken(), [
            'offset' => $offset,
            'count' => $count
        ]);

        return isset($result['card_id_list']) ? $result['card_id_list'] : false;
    }