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 4fe10bd commit 6c5562b
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' => null, 'nickname' => $user->nickname, 'name' => null,
'email' => null, 'avatar' => null,
])->setToken($token->getIdentifier(), $token->getSecret());
return (new User())->setRaw($user['extra'])->map([
'id' => null,
'nickname' => $user['nickname'],
'name' => null,
'email' => null,
'avatar' => null,
]);
}
}

0 comments on commit 6c5562b

Please sign in to comment.