Gets the User's friends.

@param string $sort Order to return friends in (onlineStatus | name-onlineId)
@param integer $offset Where to start
@param integer $limit How many friends to return
@return array Array of Api\User.
778195
public function friends($sort = 'onlineStatus', $offset = 0, $limit = 36) : array
    {
        $result = [];

        $friends = $this->get(sprintf(self::USERS_ENDPOINT . 'friends/profiles2', $this->onlineIdParameter()), [
            'fields' => 'onlineId,accountId,avatarUrls,plus,trophySummary(@default),isOfficiallyVerified,personalDetail(@default,profilePictureUrls),presences(@titleInfo,hasBroadcastData,lastOnlineDate),presences(@titleInfo),friendRelation,consoleAvailability',
            'offset' => $offset,
            'limit' => $limit,
            'profilePictureSizes' => 'm',
            'avatarSizes' => 'm',
            'titleIconSize' => 's',
            'sort' => $sort
        ]);
        
        foreach ($friends->profiles as $friend) {
            $result[] = new self($this->client, $friend);
        }

        return $result;
    }
134618
public function getUserFeed($limit = 0)
    {
        $params = array();
        if ($limit > 0) {
            $params['count'] = $limit;
        }

        return $this->_makeCall('users/self/feed', true, $params);
    }
29996
public function listRepositories(string $sort = AbstractApi::SORT_CREATED,
                                     string $direction = AbstractApi::DIRECTION_DESC, string $username = null): array
    {
        if (null !== $username) {
            return $this->getApi()->request($this->getApi()->sprintf('/users/:username/starred?:args', $username,
                http_build_query(['sort' => $sort, 'direction' => $direction])));
        }

        return $this->getApi()->request($this->getApi()->sprintf('/user/starred?:args',
            http_build_query(['sort' => $sort, 'direction' => $direction])));
    }
1267297
public function getMigrations($limit = null, $offset = null)
    {
        return $this->storageHandler->loadMigrations($limit, $offset);
    }
1018843
private function getFriend()
    {
        $friend = [];
        $friend_area = $this->_parser->find('.container-left .user-profile', 0);
        $friend_area = $friend_area->find('.user-friends', 0);

        $friend_count = $friend_area->prev_sibling()->find('a', 0)->plaintext;
        preg_match('/\(\d+\)/', $friend_count, $friend_count);
        $friend['count'] = str_replace(['(', ')'], '', $friend_count[0]);

        $friend['data'] = [];
        foreach ($friend_area->find('a') as $f) {
            $temp_friend = [];

            $temp_friend['name'] = $f->plaintext;
            $temp_friend['image'] = Helper::imageUrlCleaner($f->getAttribute('data-bg'));

            $friend['data'][] = $temp_friend;
        }

        return $friend;
    }
811566
public function GetAll(& $pagination = null, $sorting = null)
    {
        $usersList = $this->GetList('users_all', $pagination, null, null, null, $sorting);

        $users = array();
        if (is_array($usersList)) {
            foreach ($usersList as $user) {
                array_push($users, $this->GetUserResponse($user));
            }
        }
        return $users;
    }
268978
public function getPeople($offset = 0, $limit = 25)
    {
        list($offset, $limit) = $this->normalizeOffsetAndLimit($offset, $limit);

        return $this->request('people', [
            'offset' => $offset,
            'limit' => $limit,
        ]);
    }
985753
public function getItems($offset, $limit)
    {
        $this
            ->paginator
            ->getQuery()
            ->setFirstResult($offset)
            ->setMaxResults($limit)
        ;

        return iterator_to_array($this->paginator->getIterator());
    }
1345677
public function getUserAgents($limit = 0)
    {
        $counter = 0;

        foreach ($this->loadFromPath() as $test) {
            if ($limit && $counter >= $limit) {
                return;
            }

            yield trim($test->ua);
            ++$counter;
        }
    }
877703
public function getFranchises($offset = 0, $limit = 25)
    {
        list($offset, $limit) = $this->normalizeOffsetAndLimit($offset, $limit);

        return $this->request('franchises', [
            'offset' => $offset,
            'limit' => $limit,
        ]);
    }
834374
public function actionList($sort = '', $page = 1, $limit = 20)
    {
        $user_id = \Yii::$app->request->get('user_id');
        $username = \Yii::$app->request->get('username');
        $nickname = \Yii::$app->request->get('nickname');
        $group_ids = array_filter((array)\Yii::$app->request->get('group_ids'));
        $is_group_access = \Yii::$app->request->get('is_group_access');
        $is_user_access = \Yii::$app->request->get('is_user_access');
        $is_system = \Yii::$app->request->get('is_system');
        $note = \Yii::$app->request->get('note');
        $status = \Yii::$app->request->get('status');
        $limit = intval($limit);
        $order = ExtHelpers::getOrder($sort, [
            'user_id',
            'username',
            'nickname',
            'is_system',
            'note',
            'status'
        ], [], 'user_id DESC');

        $condition = '1';
        $params = [];
        if ($user_id) {
            $condition .= ' and user_id=:user_id';
            $params[':user_id'] = $user_id;
        }
        if ($username) {
            $condition .= ' and username=:username';
            $params[':username'] = $username;
        }
        if (is_numeric($is_group_access)) {
            $condition .= ' and is_group_access=:is_group_access';
            $params[':is_group_access'] = $is_group_access;
        }
        if (is_numeric($is_user_access)) {
            $condition .= ' and is_user_access=:is_user_access';
            $params[':is_user_access'] = $is_user_access;
        }
        if (is_numeric($is_system)) {
            $condition .= ' and is_system=:is_system';
            $params[':is_system'] = $is_system;
        }
        if ($note) {
            $condition .= ' and note like :note';
            $params[':note'] = '%' . $note . '%';
        }
        if ($nickname) {
            $condition .= ' and nickname like :nickname';
            $params[':nickname'] = '%' . $nickname . '%';
        }
        if ($group_ids && is_array($group_ids)) {
            $group_ids = array_filter($group_ids, function ($value) {
                return is_numeric($value);
            });
            $condition .= ' and group_ids in (' . join(',', $group_ids) . ')';
        }
        if (is_numeric($status)) {
            $condition .= ' and status=:status';
            $params[':status'] = $status;
        }
        $condition .= ' and user_id!=1';
        $data = DpAdminUser::getListByCondition($condition, $params, $order, $page, $limit);
        $list = [];
        if ($data['list']) {
            foreach ($data['list'] as $item) {
                $groupIds = StringHelper::explode($item['group_ids'], ',', true, true);
                asort($groupIds);
                $groupNames = [];
                foreach ($groupIds as $groupId) {
                    $group = DpAdminGroup::getByGroupId($groupId);
                    if ($group) {
                        $groupNames[] = $group['name'];
                    }
                }
                $list[] = [
                    'user_id' => $item['user_id'],
                    'username' => $item['username'],
                    'nickname' => $item['nickname'],
                    'group_ids' => join(',', $groupIds),
                    'group_names' => join(',', $groupNames),
                    'is_group_access' => $item['is_group_access'],
                    'is_user_access' => $item['is_user_access'],
                    'is_system' => $item['is_system'],
                    'note' => $item['note'],
                    'status' => $item['status'],
                ];
            }
        }

        return [
            'total' => $data['pagination']['totalCount'],
            'list' => $list,
        ];
    }
413045
public function getUserAgents($limit = 0)
    {
        $counter = 0;

        foreach ($this->loadFromPath() as $row) {
            if ($limit && $counter >= $limit) {
                return;
            }

            $row = json_decode($row, false);
            yield trim($row->user_agent);
            ++$counter;
        }
    }
239569
public function getFriendsIds(array $parameters = array(), $multipart = false, $appOnlyAuth = false)
    {
        return $this->get('friends/ids', $parameters, $multipart, $appOnlyAuth);
    }
331010
public function getItems($offset, $limit, $sort = null)
    {
        $items = [];
        $cnt = count($this->rawData);
        for ($i = $offset; $i < $offset + $limit && $i < $cnt; $i++) {
            $items[] = $this->rawData[$i];
        }

        return $items;
    }
907663
public function search(Search $entity, $limit, $offset, $sort_column, $sort_direction)
    {
        $selector = $this->selector
            ->create()
            ->addCountry($entity)
            ->addDateAdd($entity)
            ->addDateEnd($entity)
            ->addDatePremiere($entity)
            ->addGenres($entity)
            ->addLabels($entity)
            ->addName($entity)
            ->addStorage($entity)
            ->addStudio($entity)
            ->addType($entity)
            ->sort($sort_column, $sort_direction)
            ->limit($limit)
            ->offset($offset);

        return [
            'list' => $selector
                ->getQuerySelect()
                ->getQuery()
                ->getResult(),
            'total' => $selector
                ->getQueryTotal()
                ->getQuery()
                ->getSingleScalarResult(),
        ];
    }
8271
public function getAllFriendships($limit = null, $offset = null): array
    {
        return $this->findFriendshipsByStatus(null, $limit, $offset);
    }
36047
public function getUserFollows($id = 'self', $limit = 0)
    {
        $params = array();

        if ($limit > 0) {
            $params['count'] = $limit;
        }

        return $this->_makeCall('users/' . $id . '/follows', true, $params);
    }