Skip to content

Commit

Permalink
Big clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
DraperStudio committed Feb 25, 2015
1 parent 657e8ac commit 2c58785
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
7 changes: 6 additions & 1 deletion src/InstagramExtendSocialite.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@

class InstagramExtendSocialite
{
/**
* Execute the provider.
*/
public function handle(SocialiteWasCalled $socialiteWasCalled)
{
$socialiteWasCalled->extendSocialite('instagram', __NAMESPACE__.'\Provider');
$socialiteWasCalled->extendSocialite(
'instagram', __NAMESPACE__.'\Provider'
);
}
}
19 changes: 11 additions & 8 deletions src/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}

/**
Expand All @@ -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',
],
Expand All @@ -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'],
]);
}

Expand All @@ -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',
]);
}
}

0 comments on commit 2c58785

Please sign in to comment.