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 dfc39ef commit 9e50253
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
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://accounts.google.com/o/oauth2/auth', $state);
return $this->buildAuthUrlFromBase(
'https://accounts.google.com/o/oauth2/auth', $state
);
}

/**
Expand All @@ -33,7 +35,8 @@ protected function getTokenUrl()
*/
protected function getUserByToken($token)
{
$response = $this->getHttpClient()->get('https://www.googleapis.com/youtube/v3/channels?part=snippet&mine=true', [
$response = $this->getHttpClient()->get(
'https://www.googleapis.com/youtube/v3/channels?part=snippet&mine=true', [
'headers' => [
'Authorization' => 'Bearer '.$token,
],
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['snippet']['title'],
'name' => null,
'email' => null,
'avatar' => $user['snippet']['thumbnails']['high']['url'],
'id' => $user['id'], 'nickname' => $user['snippet']['title'],
'name' => null, 'email' => null,
'avatar' => $user['snippet']['thumbnails']['high']['url'],
]);
}

Expand All @@ -61,7 +62,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
7 changes: 6 additions & 1 deletion src/YouTubeExtendSocialite.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@

class YouTubeExtendSocialite
{
/**
* Execute the provider.
*/
public function handle(SocialiteWasCalled $socialiteWasCalled)
{
$socialiteWasCalled->extendSocialite('youtube', __NAMESPACE__.'\Provider');
$socialiteWasCalled->extendSocialite(
'youtube', __NAMESPACE__.'\Provider'
);
}
}

0 comments on commit 9e50253

Please sign in to comment.