diff --git a/VKAPI/Handlers/Friends.php b/VKAPI/Handlers/Friends.php index ca9b7573..20c537a5 100644 --- a/VKAPI/Handlers/Friends.php +++ b/VKAPI/Handlers/Friends.php @@ -133,15 +133,18 @@ final class Friends extends VKAPIRequestHandler return $response; } - function getRequests(string $fields = "", int $offset = 0, int $count = 100): object + function getRequests(string $fields = "", int $offset = 0, int $count = 100, int $extended = 0): object { + if ($count >= 1000) + $this->fail(100, "One of the required parameters was not passed or is invalid."); + $this->requireUser(); $i = 0; $offset++; $followers = []; - foreach($this->getUser()->getFollowers() as $follower) { + foreach($this->getUser()->getFollowers($offset, $count) as $follower) { $followers[$i] = $follower->getId(); $i++; } @@ -149,8 +152,10 @@ final class Friends extends VKAPIRequestHandler $response = $followers; $usersApi = new Users($this->getUser()); - if(!is_null($fields)) - $response = $usersApi->get(implode(',', $followers), $fields, 0, $count); # FIXME + if($extended == 1) + $response = $usersApi->get(implode(',', $followers), $fields, 0, $count); + else + $response = $usersApi->get(implode(',', $followers), "", 0, $count); foreach($response as $user) $user->user_id = $user->id;