mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +03:00
VKAPI: added method friends.getRequests and fix code style (#653)
This commit is contained in:
parent
0e1a672c27
commit
b117d0fe01
1 changed files with 30 additions and 3 deletions
|
@ -23,9 +23,8 @@ final class Friends extends VKAPIRequestHandler
|
|||
|
||||
$usersApi = new Users($this->getUser());
|
||||
|
||||
if(!is_null($fields)) {
|
||||
if(!is_null($fields))
|
||||
$response = $usersApi->get(implode(',', $friends), $fields, 0, $count); # FIXME
|
||||
}
|
||||
|
||||
return (object) [
|
||||
"count" => $users->get($user_id)->getFriendsCount(),
|
||||
|
@ -133,4 +132,32 @@ final class Friends extends VKAPIRequestHandler
|
|||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
function getRequests(string $fields = "", int $offset = 0, int $count = 100): object
|
||||
{
|
||||
$this->requireUser();
|
||||
|
||||
$i = 0;
|
||||
$offset++;
|
||||
$followers = [];
|
||||
|
||||
foreach($this->getUser()->getFollowers() as $follower) {
|
||||
$followers[$i] = $follower->getId();
|
||||
$i++;
|
||||
}
|
||||
|
||||
$response = $followers;
|
||||
$usersApi = new Users($this->getUser());
|
||||
|
||||
if(!is_null($fields))
|
||||
$response = $usersApi->get(implode(',', $followers), $fields, 0, $count); # FIXME
|
||||
|
||||
foreach($response as $user)
|
||||
$user->user_id = $user->id;
|
||||
|
||||
return (object) [
|
||||
"count" => $this->getUser()->getFollowersCount(),
|
||||
"items" => $response
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue