From 2c58785745a4210a48178693f85daf049fedecf9 Mon Sep 17 00:00:00 2001 From: DraperStudio Date: Wed, 25 Feb 2015 11:53:57 +0100 Subject: [PATCH] Big clean up --- src/InstagramExtendSocialite.php | 7 ++++++- src/Provider.php | 19 +++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/InstagramExtendSocialite.php b/src/InstagramExtendSocialite.php index 1b9fd3f..6118c1b 100644 --- a/src/InstagramExtendSocialite.php +++ b/src/InstagramExtendSocialite.php @@ -5,8 +5,13 @@ class InstagramExtendSocialite { + /** + * Execute the provider. + */ public function handle(SocialiteWasCalled $socialiteWasCalled) { - $socialiteWasCalled->extendSocialite('instagram', __NAMESPACE__.'\Provider'); + $socialiteWasCalled->extendSocialite( + 'instagram', __NAMESPACE__.'\Provider' + ); } } diff --git a/src/Provider.php b/src/Provider.php index 383aca3..85eb7a1 100644 --- a/src/Provider.php +++ b/src/Provider.php @@ -17,7 +17,9 @@ class Provider extends AbstractProvider implements ProviderInterface */ protected function getAuthUrl($state) { - return $this->buildAuthUrlFromBase('https://api.instagram.com/oauth/authorize', $state); + return $this->buildAuthUrlFromBase( + 'https://api.instagram.com/oauth/authorize', $state + ); } /** @@ -33,7 +35,8 @@ protected function getTokenUrl() */ protected function getUserByToken($token) { - $response = $this->getHttpClient()->get('https://api.instagram.com/v1/users/self?access_token='.$token, [ + $response = $this->getHttpClient()->get( + 'https://api.instagram.com/v1/users/self?access_token='.$token, [ 'headers' => [ 'Accept' => 'application/json', ], @@ -48,11 +51,9 @@ protected function getUserByToken($token) protected function mapUserToObject(array $user) { return (new User())->setRaw($user)->map([ - 'id' => $user['id'], - 'nickname' => $user['username'], - 'name' => $user['full_name'], - 'email' => null, - 'avatar' => $user['profile_picture'], + 'id' => $user['id'], 'nickname' => $user['username'], + 'name' => $user['full_name'], 'email' => null, + 'avatar' => $user['profile_picture'], ]); } @@ -73,6 +74,8 @@ public function getAccessToken($code) */ protected function getTokenFields($code) { - return array_merge(parent::getTokenFields($code), ['grant_type' => 'authorization_code']); + return array_merge(parent::getTokenFields($code), [ + 'grant_type' => 'authorization_code', + ]); } }