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 2191dcb commit 6501eaf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
7 changes: 6 additions & 1 deletion src/GoogleExtendSocialite.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@

class GoogleExtendSocialite
{
/**
* Execute the provider.
*/
public function handle(SocialiteWasCalled $socialiteWasCalled)
{
$socialiteWasCalled->extendSocialite('google', __NAMESPACE__.'\Provider');
$socialiteWasCalled->extendSocialite(
'google', __NAMESPACE__.'\Provider'
);
}
}
20 changes: 12 additions & 8 deletions src/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class Provider extends AbstractProvider implements ProviderInterface
*/
protected function getAuthUrl($state)
{
return $this->buildAuthUrlFromBase('https://accounts.google.com/o/oauth2/auth', $state);
return $this->buildAuthUrlFromBase(
'https://accounts.google.com/o/oauth2/auth', $state
);
}

/**
Expand All @@ -42,7 +44,8 @@ protected function getTokenUrl()
*/
protected function getUserByToken($token)
{
$response = $this->getHttpClient()->get('https://www.googleapis.com/plus/v1/people/me', [
$response = $this->getHttpClient()->get(
'https://www.googleapis.com/plus/v1/people/me', [
'headers' => [
'Authorization' => 'Bearer '.$token,
],
Expand All @@ -57,11 +60,10 @@ protected function getUserByToken($token)
protected function mapUserToObject(array $user)
{
return (new User())->setRaw($user)->map([
'id' => $user['id'],
'nickname' => array_get($user, 'nickname'),
'name' => $user['displayName'],
'email' => $user['emails'][0]['value'],
'avatar' => array_get($user, 'image')['url'],
'id' => $user['id'], 'nickname' => array_get($user, 'nickname'),
'name' => $user['displayName'],
'email' => $user['emails'][0]['value'],
'avatar' => array_get($user, 'image')['url'],
]);
}

Expand All @@ -70,7 +72,9 @@ protected function mapUserToObject(array $user)
*/
protected function getTokenFields($code)
{
return array_merge(parent::getTokenFields($code), ['grant_type' => 'authorization_code']);
return array_merge(parent::getTokenFields($code), [
'grant_type' => 'authorization_code',
]);
}

/**
Expand Down

0 comments on commit 6501eaf

Please sign in to comment.