forked from SocialiteProviders/Twitter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Provider.php
42 lines (35 loc) · 983 Bytes
/
Provider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace SocialiteProviders\Twitter;
use SocialiteProviders\Manager\OAuth1\User;
use SocialiteProviders\Manager\OAuth1\AbstractProvider;
class Provider extends AbstractProvider
{
/**
* Unique Provider Identifier.
*/
const IDENTIFIER = 'TWITTER';
/**
* {@inheritdoc}
*/
protected function mapUserToObject(array $user)
{
return (new User())->setRaw($user['extra'])->map([
'id' => $user['id'],
'nickname' => $user['nickname'],
'name' => $user['name'],
'email' => $user['email'],
'avatar' => $user['avatar'],
]);
}
/**
* @return $this
*/
public function applyConfig()
{
$tokenCredentials = $this->server->getClientCredentials();
$config = $this->config;
$tokenCredentials->setIdentifier($config->clientId);
$tokenCredentials->setSecret($config->clientSecret);
return $this;
}
}