Randomize the order at which statuses for the specified social media
profile will be sent out of the buffer.

@param  string   $id
@param  integer  $count
@param  boolean  $utc
@return array
185008
public function shuffleProfileUpdates($id, $count = null, $utc = false)
    {
        $payload = $this->buildShuffleProfileUpdatesPayload($count, $utc);

        return $this->send($this->getHttp()->post($this->url.'profiles/'.$id.'/updates/shuffle.json', null, $payload));
    }
1077362
public function orderAt($uuid, $position, $userId, $webspaceKey, $locale)
    {
        $document = $this->documentManager->find($uuid, $locale);

        $parentDocument = $this->inspector->getParent($document);
        $siblingDocuments = $this->inspector->getChildren($parentDocument);

        $siblings = array_values($siblingDocuments->toArray()); // get indexed array
        $countSiblings = count($siblings);
        $currentPosition = array_search($document, $siblings) + 1;

        if ($countSiblings < $position || $position <= 0) {
            throw new InvalidOrderPositionException(
                sprintf(
                    'Cannot order node "%s" at out-of-range position "%s", must be >= 0 && < %d"',
                    $this->inspector->getPath($document),
                    $position,
                    $countSiblings
                )
            );
        }

        if ($position === $countSiblings) {
            // move to the end
            $this->documentManager->reorder($document, null);
        } else {
            if ($currentPosition < $position) {
                $targetSibling = $siblings[$position];
            } elseif ($currentPosition > $position) {
                $targetSibling = $siblings[$position - 1];
            }

            $this->documentManager->reorder($document, $targetSibling->getUuid());
        }

        $this->documentManager->flush();

        return $this->documentToStructure($document);
    }
1282502
public static function repeatSecondlyForTotalCount($count, $seconds = 1) {
        if($count < 1) {
            throw new \InvalidArgumentException(sprintf('Total count of firings must be at least one! Given count: "%s"', $count));
        }

        return static::simpleSchedule()
            ->withIntervalInSeconds($seconds)
            ->withRepeatCount($count - 1);
    }
174369
public function postSave(Event $event, $id, $count) {
        if (!$this->getConfig('onSave') || !$this->_saveIndex) {
            return;
        }

        $this->_insertNode($id, $this->_saveIndex);
        $this->_saveIndex = null;
    }
1277048
public function setCount( $count )
	{
		if ( $count == $this->getCount() ) { return; }

		$this->_values['count'] = (string) $count;
		$this->setModified();
	}
104561
private function query($count)
    {
        $this->applyQueryFilters();

        if ($this->hasTranslating()) {
            $this->applyTranslationFilter();
        }

        if ($this->orderBy()) {
            $this->query = $this->query->orderBy(
                                $this->orderBy(),
                                $this->sortBy()
                            );
        }

        if ($count) {
            return $this->query->count();
        }

        if ($this->perPage > 0) {
            return $this->query->paginate($this->perPage);
        }

        return $this->query->get();
    }
395988
public function batchGetCardLocation($offset = 0, $count = 0)
    {
        return $this->auth(function () use ($offset, $count) {
            $data = json_encode(['offset' => $offset, 'count' => $count], JSON_UNESCAPED_UNICODE);
            $result = $this->http->postJson(
                $this->baseUrl . 'card/location/batchget?access_token=' . $this->accessToken,
                $data
            );

            return $result;
        });
    }
225329
private function getStatementSubtree($locationId, $count = false)
    {
        /**
         * @var \eZ\Publish\SPI\Persistence\Content\Location\Handler
         */
        $locationHandler = $this->getContainer()->get('ezpublish.spi.persistence.location_handler');
        $location = $locationHandler->load($locationId);
        $q = $this->connection->createQueryBuilder()
            ->select($count ? 'count(DISTINCT c.id)' : 'DISTINCT c.id')
            ->from('ezcontentobject', 'c')
            ->innerJoin('c', 'ezcontentobject_tree', 't', 't.contentobject_id = c.id')
            ->where('c.status = :status')
            ->andWhere('t.path_string LIKE :path')
            ->setParameter('status', ContentInfo::STATUS_PUBLISHED, PDO::PARAM_INT)
            ->setParameter('path', $location->pathString . '%', PDO::PARAM_STR);

        return $q->execute();
    }
286081
public function deleteDependents(Event $event, $ids, $count) {
        $rfk = $this->getRelatedForeignKey();

        $this->query(Query::UPDATE)->where($rfk, $ids)->save([$rfk => null]);
    }
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);
    }
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);
    }
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,
                ]
            )
        )
        );
    }
347418
function followers_active( $uid,  $count = 20)
	{
		$param = array();
		$this->id_format($uid);
		$param['uid'] = $uid;
		$param['count'] = $count;
		return $this->oauth->get( 'friendships/followers/active', $param);
	}
755821
public function usersStatus($id, $status)
    {
        $statuses = ["free", "busy", "dinner", "break"];

        if (empty($status) || !in_array($status, $statuses)) {
            throw new \InvalidArgumentException(
                'Parameter `status` must be not empty & must be equal one of these values: free|busy|dinner|break'
            );
        }

        /** @noinspection PhpUndefinedMethodInspection */
        return $this->client->makeRequest(
            "/users/$id/status",
            "POST",
            ['status' => $status]
        );
    }
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'];
    }
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);
    }
581115
protected function buildReorderProfileUpdatesPayload($order, $offset, $utc)
    {
        $payload = array();

        $payload['order'] = $order;

        if (is_numeric($offset)) {
            $payload['offset'] = $offset;
        }

        if ($utc) {
            $payload['utc'] = true;
        }

        return $payload;
    }