diff --git a/phpunit.xml b/phpunit.xml index 6549e92..4abf1df 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -20,4 +20,4 @@ - \ No newline at end of file + diff --git a/src/League/OAuth2/Client/Grant/Authorizationcode.php b/src/League/OAuth2/Client/Grant/Authorizationcode.php index 7744079..4249f0d 100644 --- a/src/League/OAuth2/Client/Grant/Authorizationcode.php +++ b/src/League/OAuth2/Client/Grant/Authorizationcode.php @@ -4,8 +4,8 @@ namespace League\OAuth2\Client\Grant; use League\OAuth2\Client\Token\AccessToken as AccessToken; -class Authorizationcode implements GrantInterface { - +class Authorizationcode implements GrantInterface +{ public function __toString() { return 'authorization_code'; @@ -24,4 +24,4 @@ class Authorizationcode implements GrantInterface { { return new AccessToken($response); } -} \ No newline at end of file +} diff --git a/src/League/OAuth2/Client/Grant/GrantInterface.php b/src/League/OAuth2/Client/Grant/GrantInterface.php index 8cf6bbf..ecad1f1 100644 --- a/src/League/OAuth2/Client/Grant/GrantInterface.php +++ b/src/League/OAuth2/Client/Grant/GrantInterface.php @@ -2,12 +2,12 @@ namespace League\OAuth2\Client\Grant; -interface GrantInterface { - +interface GrantInterface +{ public function __toString(); public function handleResponse($response = array()); public function prepRequestParams($defaultParams, $params); -} \ No newline at end of file +} diff --git a/src/League/OAuth2/Client/Provider/IdentityProvider.php b/src/League/OAuth2/Client/Provider/IdentityProvider.php index 92a95b7..d01a25c 100644 --- a/src/League/OAuth2/Client/Provider/IdentityProvider.php +++ b/src/League/OAuth2/Client/Provider/IdentityProvider.php @@ -7,8 +7,8 @@ use League\OAuth2\Client\Token\AccessToken as AccessToken; use League\OAuth2\Client\Token\Authorize as AuthorizeToken; use League\OAuth2\Client\Exception\IDPException as IDPException; -abstract class IdentityProvider { - +abstract class IdentityProvider +{ public $clientId = ''; public $clientSecret = ''; diff --git a/src/League/OAuth2/Client/Provider/LinkedIn.php b/src/League/OAuth2/Client/Provider/LinkedIn.php index 460bb0f..6922806 100644 --- a/src/League/OAuth2/Client/Provider/LinkedIn.php +++ b/src/League/OAuth2/Client/Provider/LinkedIn.php @@ -2,7 +2,7 @@ namespace League\OAuth2\Client\Provider; -class Linkedin extends IdentityProvider +class LinkedIn extends IdentityProvider { public $scopes = array('r_basicprofile r_emailaddress r_contactinfo'); public $responseType = 'json'; @@ -39,7 +39,7 @@ class Linkedin extends IdentityProvider return $user; } - + public function userUid($response, \League\OAuth2\Client\Token\AccessToken $token) { return $response->id; diff --git a/src/League/OAuth2/Client/Provider/User.php b/src/League/OAuth2/Client/Provider/User.php index ee95ee6..857eb78 100644 --- a/src/League/OAuth2/Client/Provider/User.php +++ b/src/League/OAuth2/Client/Provider/User.php @@ -2,8 +2,8 @@ namespace League\OAuth2\Client\Provider; -class User implements \IteratorAggregate { - +class User implements \IteratorAggregate +{ public $uid = null; public $nickname = null; public $name = null; @@ -37,4 +37,3 @@ class User implements \IteratorAggregate { } } - diff --git a/src/League/OAuth2/Client/Provider/Vkontakte.php b/src/League/OAuth2/Client/Provider/Vkontakte.php index efffe9e..2fa8075 100644 --- a/src/League/OAuth2/Client/Provider/Vkontakte.php +++ b/src/League/OAuth2/Client/Provider/Vkontakte.php @@ -19,38 +19,38 @@ class Vkontakte extends IdentityProvider public function urlUserDetails(\League\OAuth2\Client\Token\AccessToken $token) { - $fields = array('nickname', - 'screen_name', - 'sex', - 'bdate', - 'city', - 'country', - 'timezone', - 'photo_50', - 'photo_100', - 'photo_200_orig', - 'has_mobile', - 'contacts', - 'education', - 'online', - 'counters', - 'relation', - 'last_seen', - 'status', - 'can_write_private_message', - 'can_see_all_posts', - 'can_see_audio', - 'can_post', - 'universities', - 'schools', - 'verified'); - + $fields = array('nickname', + 'screen_name', + 'sex', + 'bdate', + 'city', + 'country', + 'timezone', + 'photo_50', + 'photo_100', + 'photo_200_orig', + 'has_mobile', + 'contacts', + 'education', + 'online', + 'counters', + 'relation', + 'last_seen', + 'status', + 'can_write_private_message', + 'can_see_all_posts', + 'can_see_audio', + 'can_post', + 'universities', + 'schools', + 'verified'); + return "https://api.vk.com/method/users.get?user_id={$token->uid}&fields=".implode(",", $fields)."&access_token=".$token; } - + public function userDetails($response, \League\OAuth2\Client\Token\AccessToken $token) { - $response = $response->response[0]; + $response = $response->response[0]; $user = new User; $user->uid = $response->uid; @@ -68,22 +68,22 @@ class Vkontakte extends IdentityProvider public function userUid($response, \League\OAuth2\Client\Token\AccessToken $token) { - $response = $response->response[0]; - + $response = $response->response[0]; + return $response->uid; } public function userEmail($response, \League\OAuth2\Client\Token\AccessToken $token) { - $response = $response->response[0]; - + $response = $response->response[0]; + return isset($response->email) && $response->email ? $response->email : null; } public function userScreenName($response, \League\OAuth2\Client\Token\AccessToken $token) { - $response = $response->response[0]; - + $response = $response->response[0]; + return array($response->first_name, $response->last_name); } } diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index ff9fb28..a0e4735 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -1,6 +1,5 @@ wget http://getcomposer.org/composer.phar\n> php composer.phar install\n"); -} \ No newline at end of file +}