搜索微博时的联想搜索建议

对应API：{@link http://open.weibo.com/wiki/2/search/suggestions/statuses search/suggestions/statuses}

@param string $q 搜索的关键字，必须做URLencoding。必填
@param int $count 返回的记录条数，默认为10。
@return array
423858
function search_statuses( $q,  $count = 10)
	{
		$params = array();
		$params['q'] = $q;
		$params['count'] = $count;
		return $this->oauth->get( 'search/suggestions/statuses', $params );
	}
126028
public function stream_read( $count )
    {
        $ret = substr( $this->string, $this->position, $count );
        $this->position += strlen( $ret );
        return $ret;
    }
600733
protected function get_sql_and_params($count = false) {
        $fields = 'p.id, p.userid, p.name, ';

        // Add extra user fields that we need for the graded user.
        $extrafields = get_extra_user_fields($this->context);
        foreach ($extrafields as $field) {
            $fields .= 'u.' . $field . ', ';
        }
        $fields .= get_all_user_name_fields(true, 'u');

        if ($count) {
            $select = "COUNT(1)";
        } else {
            $select = "$fields";
        }

        $sql = "SELECT $select
                  FROM {" . \core_competency\plan::TABLE . "} p
                  JOIN {user} u ON u.id = p.userid
                 WHERE p.templateid = :templateid";
        $params = array('templateid' => $this->template->get('id'));

        // Add order by if needed.
        if (!$count && $sqlsort = $this->get_sql_sort()) {
            $sql .= " ORDER BY " . $sqlsort;
        }

        return array($sql, $params);
    }
538594
public function slowlogGet($count = null) {
        $payload = ['slowlog', 'get'];

        if ($count !== null) {
            $payload[] = $count;
        }

        return $this->send($payload);
    }
351741
public function getConstrainedKeysByCount($count, $operator = '>=')
	{
		$associativeLocal = $this->associativeLocal;

		return $this->getConstrainedKeys(function($related) use ($count, $associativeLocal, $operator)
		{
			$related->group($associativeLocal)->having('COUNT(*)', $operator, $count);
		});
	}
1173684
private function walk($count = 1)
    {
        $token = $nextToken = $this->lexer->token;

        for ($i = 0; ($i < $count) || ($token === $nextToken); ++$i) {
            $this->lexer->moveNext();
            $nextToken = $this->lexer->token;
        }

        return $nextToken;
    }
1340011
private function readPoints($count)
    {
        $points = array();

        for ($i = 0; $i < $count; $i++) {
            $points[] = $this->point();
        }

        return $points;
    }
507588
protected function getListReportLibrary($count = false)
    {
        $list = $this->library->getList();
        $this->prepareListLibrary($list);

        $allowed = $this->getAllowedFiltersReportLibrary();

        $this->filterList($list, $allowed, $this->query_filter);
        $this->sortList($list, $allowed, $this->query_filter, array('name' => 'desc'));

        if ($count) {
            return count($list);
        }

        $this->limitList($list, $this->data_limit);
        return $list;
    }
577792
public function getConstrainedKeysByCount($count, $operator = '>=')
	{
		$associativeTable = $this->associativeTable;
		$associativeLocal = $this->associativeLocal;
		$shifter          = $this->shifter;
		$model            = $this->model;

		return $this->getConstrainedKeys(function($related) use ($count, $associativeTable, $associativeLocal, $shifter, $model, $operator)
		{
			$related->whereEquals($associativeTable . '.' . $shifter, strtolower($model->getModelName()))
			        ->group($shifter)
			        ->group($associativeLocal)
			        ->having('COUNT(*)', $operator, $count);
		});
	}
27073
public function getEmailsBy($criteria, $count)
    {
        $mails = [];
        $mailIds = $this->search($criteria);

        if (!$count) {
            if (!$mailIds) {
                throw new \Exception(sprintf("No email found with given criteria %s", $criteria));
            }
        }

        foreach ($mailIds as $mailId) {
            $mails[] = $this->mailbox->getMail($mailId);

        }

        return $mails;
    }
760231
public function searchTweets($query, $count = 10)
	{	
		if ($this->bearer_token == null) {
			throw new \Exception('Incorrect token. You need to obtain correct Bearer token in order to make calls to the API. Check if your API keys are correct.');
		}

		$this->makeRequest($query, $count);
	}
493313
public function makeRequest($query, $count)
	{

		try { 
 			
 			$response = $this->client->request('GET', self::$api_base.'1.1/search/tweets.json', [
			    'query' => ['q' => $query, 'count' => $count],
			    'headers' => [
			        'Authorization' => 'Bearer ' . $this->bearer_token
			    ]
			]);
  			
			$this->setStatusCode($response->getStatusCode());

			$response_body = json_decode($response->getBody());
 			$this->response = $response_body->statuses;
 
 		} catch (\Exception $e) {

			$this->setStatusCode($e->getCode());
			$this->setResponse($e->getMessage());

		}
	}
368442
public function getGroupList($begin = 0, $count = 10)
    {
        $url = "https://api.weixin.qq.com/shakearound/device/group/getlist?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['begin' => $begin, 'count' => $count]);
    }
1104609
public function batchGet($offset, $count = 50, array $status_list = [])
    {
        $data = ['offset' => $offset, 'count' => $count];
        empty($status_list) || $data['status_list'] = $status_list;
        $url = "https://api.weixin.qq.com/card/batchget?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
1231670
public function countByStatus($status)
    {
        $qb = $this->createQueryBuilder('q');
        $qb->where($qb->expr()->eq('q.status', $qb->expr()->literal($status)));
        $qb->select('COUNT(q.id)');

        return (int) $qb->getQuery()->getSingleScalarResult();
    }
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'];
    }
930814
protected function getTokenCharacters($count = 1)
    {
        $result = '';
        for ($i = 0; $i < $count; $i++) {
            $result .= $this->tokenChars[mt_rand(0, count($this->tokenChars) - 1)];
        }
        return $result;
    }