Skip to content

Commit

Permalink
Add mapUserToObject method
Browse files Browse the repository at this point in the history
  • Loading branch information
DraperStudio committed Apr 7, 2016
1 parent 183b550 commit bb836b1
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,14 @@ class Provider extends AbstractProvider
/**
* {@inheritdoc}
*/
public function user()
protected function mapUserToObject(array $user)
{
if (!$this->hasNecessaryVerifier()) {
throw new \InvalidArgumentException('Invalid request. Missing OAuth verifier.');
}

$user = $this->server->getUserDetails($token = $this->getToken());

return (new User())->setRaw($user->extra)->map([
'id' => $user->id, 'nickname' => $user->nickname,
'name' => null, 'email' => null, 'avatar' => $user->avatar,
])->setToken($token->getIdentifier(), $token->getSecret());
return (new User())->setRaw($user['extra'])->map([
'id' => $user['id'],
'nickname' => $user['nickname'],
'name' => null,
'email' => null,
'avatar' => $user['avatar'],
]);
}
}

0 comments on commit bb836b1

Please sign in to comment.