From 6854cb3f4d8219cf1829e32122eb2502a916eae9 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 1 Feb 2020 09:05:48 +0100 Subject: initial checkin --- .../oauth2-client/src/Provider/Vkontakte.php | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 vendor/league/oauth2-client/src/Provider/Vkontakte.php (limited to 'vendor/league/oauth2-client/src/Provider/Vkontakte.php') diff --git a/vendor/league/oauth2-client/src/Provider/Vkontakte.php b/vendor/league/oauth2-client/src/Provider/Vkontakte.php new file mode 100644 index 0000000..da44ae2 --- /dev/null +++ b/vendor/league/oauth2-client/src/Provider/Vkontakte.php @@ -0,0 +1,99 @@ +uid}&fields=" + .implode(",", $fields)."&access_token={$token}"; + } + + public function userDetails($response, AccessToken $token) + { + $response = $response->response[0]; + + $user = new User(); + + $email = (isset($response->email)) ? $response->email : null; + $location = (isset($response->country)) ? $response->country : null; + $description = (isset($response->status)) ? $response->status : null; + + $user->exchangeArray([ + 'uid' => $response->uid, + 'nickname' => $response->nickname, + 'name' => $response->screen_name, + 'firstname' => $response->first_name, + 'lastname' => $response->last_name, + 'email' => $email, + 'location' => $location, + 'description' => $description, + 'imageUrl' => $response->photo_200_orig, + ]); + + return $user; + } + + public function userUid($response, AccessToken $token) + { + $response = $response->response[0]; + + return $response->uid; + } + + public function userEmail($response, AccessToken $token) + { + $response = $response->response[0]; + + return isset($response->email) && $response->email ? $response->email : null; + } + + public function userScreenName($response, AccessToken $token) + { + $response = $response->response[0]; + + return [$response->first_name, $response->last_name]; + } +} -- cgit v1.2.3-70-g09d2