Skip to content

Commit

Permalink
chore: style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
atymic committed May 6, 2020
1 parent e58ad53 commit a635f94
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ protected function getAuthUrl($state)
protected function getCodeFields($state = null)
{
$fields = [
'app_id' => $this->clientId,
'app_id' => $this->clientId,
'redirect_uri' => $this->redirectUrl,
'state' => $state,
'state' => $state,
];

return array_merge($fields, $this->parameters);
}

Expand All @@ -45,8 +46,9 @@ public function getAccessTokenResponse($code)
{
$response = $this->getHttpClient()->get($this->getTokenUrl(), [
'headers' => ['Accept' => 'application/json'],
'query' => $this->getTokenFields($code),
'query' => $this->getTokenFields($code),
]);

return json_decode($response->getBody(), true);
}

Expand All @@ -63,7 +65,7 @@ protected function getTokenUrl()
*/
protected function getUserByToken($token)
{
$response = $this->getHttpClient()->get('https://graph.zalo.me/v2.0/me?access_token=' . $token . '&fields=id,birthday,name,gender,picture');
$response = $this->getHttpClient()->get('https://graph.zalo.me/v2.0/me?access_token='.$token.'&fields=id,birthday,name,gender,picture');

return json_decode($response->getBody(), true);
}
Expand All @@ -74,10 +76,10 @@ protected function getUserByToken($token)
protected function mapUserToObject(array $user)
{
return (new User())->setRaw($user)->map([
'id' => $user['id'],
'id' => $user['id'],
'nickname' => null,
'name' => $user['name'],
'avatar' => preg_replace('/^http:/i', 'https:', $user['picture']['data']['url']),
'name' => $user['name'],
'avatar' => preg_replace('/^http:/i', 'https:', $user['picture']['data']['url']),
]);
}

Expand All @@ -87,9 +89,9 @@ protected function mapUserToObject(array $user)
protected function getTokenFields($code)
{
return [
'app_id' => $this->clientId,
'app_secret' => $this->clientSecret,
'code' => $code,
'app_id' => $this->clientId,
'app_secret' => $this->clientSecret,
'code' => $code,
'redirect_uri' => $this->redirectUrl,
];
}
Expand Down

0 comments on commit a635f94

Please sign in to comment.