@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | interface ExceptionInterface |
14 | 14 | { |
15 | - /* |
|
15 | + /* |
|
16 | 16 | ExceptionInterface |
17 | 17 | Exception extends \Exception implements ExceptionInterface |
18 | 18 | | RuntimeException extends Exception |
@@ -14,37 +14,37 @@ |
||
14 | 14 | */ |
15 | 15 | class Psr3LoggerWrapper implements LoggerInterface |
16 | 16 | { |
17 | - use LoggerAwareTrait; |
|
17 | + use LoggerAwareTrait; |
|
18 | 18 | |
19 | - /** |
|
20 | - * @inheritdoc |
|
21 | - */ |
|
22 | - public function info($message, array $context = []) |
|
23 | - { |
|
24 | - $this->logger->info($message, $context); |
|
25 | - } |
|
19 | + /** |
|
20 | + * @inheritdoc |
|
21 | + */ |
|
22 | + public function info($message, array $context = []) |
|
23 | + { |
|
24 | + $this->logger->info($message, $context); |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * @inheritdoc |
|
29 | - */ |
|
30 | - public function debug($message, array $context = []) |
|
31 | - { |
|
32 | - $this->logger->debug($message, $context); |
|
33 | - } |
|
27 | + /** |
|
28 | + * @inheritdoc |
|
29 | + */ |
|
30 | + public function debug($message, array $context = []) |
|
31 | + { |
|
32 | + $this->logger->debug($message, $context); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * @inheritdoc |
|
37 | - */ |
|
38 | - public function error($message, array $context = []) |
|
39 | - { |
|
40 | - $this->logger->error($message, $context); |
|
41 | - } |
|
35 | + /** |
|
36 | + * @inheritdoc |
|
37 | + */ |
|
38 | + public function error($message, array $context = []) |
|
39 | + { |
|
40 | + $this->logger->error($message, $context); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @inheritdoc |
|
45 | - */ |
|
46 | - public function log($level, $message, array $context = []) |
|
47 | - { |
|
48 | - $this->logger->log($level, $message, $context); |
|
49 | - } |
|
43 | + /** |
|
44 | + * @inheritdoc |
|
45 | + */ |
|
46 | + public function log($level, $message, array $context = []) |
|
47 | + { |
|
48 | + $this->logger->log($level, $message, $context); |
|
49 | + } |
|
50 | 50 | } |
@@ -17,18 +17,18 @@ |
||
17 | 17 | */ |
18 | 18 | class BlizzardAPAC extends Blizzard |
19 | 19 | { |
20 | - /** |
|
21 | - * {@inheritdoc} |
|
22 | - */ |
|
23 | - protected $apiBaseUrl = 'https://apac.battle.net/'; |
|
20 | + /** |
|
21 | + * {@inheritdoc} |
|
22 | + */ |
|
23 | + protected $apiBaseUrl = 'https://apac.battle.net/'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * {@inheritdoc} |
|
27 | - */ |
|
28 | - protected $authorizeUrl = 'https://apac.battle.net/oauth/authorize'; |
|
25 | + /** |
|
26 | + * {@inheritdoc} |
|
27 | + */ |
|
28 | + protected $authorizeUrl = 'https://apac.battle.net/oauth/authorize'; |
|
29 | 29 | |
30 | - /** |
|
31 | - * {@inheritdoc} |
|
32 | - */ |
|
33 | - protected $accessTokenUrl = 'https://apac.battle.net/oauth/token'; |
|
30 | + /** |
|
31 | + * {@inheritdoc} |
|
32 | + */ |
|
33 | + protected $accessTokenUrl = 'https://apac.battle.net/oauth/token'; |
|
34 | 34 | } |
@@ -17,18 +17,18 @@ |
||
17 | 17 | */ |
18 | 18 | class BlizzardEU extends Blizzard |
19 | 19 | { |
20 | - /** |
|
21 | - * {@inheritdoc} |
|
22 | - */ |
|
23 | - protected $apiBaseUrl = 'https://eu.battle.net/'; |
|
20 | + /** |
|
21 | + * {@inheritdoc} |
|
22 | + */ |
|
23 | + protected $apiBaseUrl = 'https://eu.battle.net/'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * {@inheritdoc} |
|
27 | - */ |
|
28 | - protected $authorizeUrl = 'https://eu.battle.net/oauth/authorize'; |
|
25 | + /** |
|
26 | + * {@inheritdoc} |
|
27 | + */ |
|
28 | + protected $authorizeUrl = 'https://eu.battle.net/oauth/authorize'; |
|
29 | 29 | |
30 | - /** |
|
31 | - * {@inheritdoc} |
|
32 | - */ |
|
33 | - protected $accessTokenUrl = 'https://eu.battle.net/oauth/token'; |
|
30 | + /** |
|
31 | + * {@inheritdoc} |
|
32 | + */ |
|
33 | + protected $accessTokenUrl = 'https://eu.battle.net/oauth/token'; |
|
34 | 34 | } |
@@ -17,66 +17,66 @@ |
||
17 | 17 | */ |
18 | 18 | class TwitchTV extends OAuth2 |
19 | 19 | { |
20 | - /** |
|
21 | - * {@inheritdoc} |
|
22 | - */ |
|
23 | - protected $scope = 'user:read:email'; |
|
24 | - |
|
25 | - /** |
|
26 | - * {@inheritdoc} |
|
27 | - */ |
|
28 | - protected $apiBaseUrl = 'https://api.twitch.tv/helix/'; |
|
29 | - |
|
30 | - /** |
|
31 | - * {@inheritdoc} |
|
32 | - */ |
|
33 | - protected $authorizeUrl = 'https://id.twitch.tv/oauth2/authorize'; |
|
34 | - |
|
35 | - /** |
|
36 | - * {@inheritdoc} |
|
37 | - */ |
|
38 | - protected $accessTokenUrl = 'https://id.twitch.tv/oauth2/token'; |
|
39 | - |
|
40 | - /** |
|
41 | - * {@inheritdoc} |
|
42 | - */ |
|
43 | - protected $apiDocumentation = 'https://dev.twitch.tv/docs/authentication/'; |
|
44 | - |
|
45 | - /** |
|
46 | - * {@inheritdoc} |
|
47 | - */ |
|
48 | - protected function initialize() |
|
49 | - { |
|
50 | - parent::initialize(); |
|
51 | - |
|
52 | - $this->apiRequestHeaders['Client-ID'] = $this->clientId; |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * {@inheritdoc} |
|
57 | - */ |
|
58 | - public function getUserProfile() |
|
59 | - { |
|
60 | - $response = $this->apiRequest('users'); |
|
61 | - |
|
62 | - $data = new Data\Collection($response); |
|
63 | - |
|
64 | - if (!$data->exists('data')) { |
|
65 | - throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
66 | - } |
|
67 | - |
|
68 | - $users = $data->filter('data')->values(); |
|
69 | - $user = new Data\Collection($users[0]); |
|
70 | - |
|
71 | - $userProfile = new User\Profile(); |
|
72 | - |
|
73 | - $userProfile->identifier = $user->get('id'); |
|
74 | - $userProfile->displayName = $user->get('display_name'); |
|
75 | - $userProfile->photoURL = $user->get('profile_image_url'); |
|
76 | - $userProfile->email = $user->get('email'); |
|
77 | - $userProfile->description = strip_tags($user->get('description')); |
|
78 | - $userProfile->profileURL = "https://www.twitch.tv/{$userProfile->displayName}"; |
|
79 | - |
|
80 | - return $userProfile; |
|
81 | - } |
|
20 | + /** |
|
21 | + * {@inheritdoc} |
|
22 | + */ |
|
23 | + protected $scope = 'user:read:email'; |
|
24 | + |
|
25 | + /** |
|
26 | + * {@inheritdoc} |
|
27 | + */ |
|
28 | + protected $apiBaseUrl = 'https://api.twitch.tv/helix/'; |
|
29 | + |
|
30 | + /** |
|
31 | + * {@inheritdoc} |
|
32 | + */ |
|
33 | + protected $authorizeUrl = 'https://id.twitch.tv/oauth2/authorize'; |
|
34 | + |
|
35 | + /** |
|
36 | + * {@inheritdoc} |
|
37 | + */ |
|
38 | + protected $accessTokenUrl = 'https://id.twitch.tv/oauth2/token'; |
|
39 | + |
|
40 | + /** |
|
41 | + * {@inheritdoc} |
|
42 | + */ |
|
43 | + protected $apiDocumentation = 'https://dev.twitch.tv/docs/authentication/'; |
|
44 | + |
|
45 | + /** |
|
46 | + * {@inheritdoc} |
|
47 | + */ |
|
48 | + protected function initialize() |
|
49 | + { |
|
50 | + parent::initialize(); |
|
51 | + |
|
52 | + $this->apiRequestHeaders['Client-ID'] = $this->clientId; |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * {@inheritdoc} |
|
57 | + */ |
|
58 | + public function getUserProfile() |
|
59 | + { |
|
60 | + $response = $this->apiRequest('users'); |
|
61 | + |
|
62 | + $data = new Data\Collection($response); |
|
63 | + |
|
64 | + if (!$data->exists('data')) { |
|
65 | + throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
66 | + } |
|
67 | + |
|
68 | + $users = $data->filter('data')->values(); |
|
69 | + $user = new Data\Collection($users[0]); |
|
70 | + |
|
71 | + $userProfile = new User\Profile(); |
|
72 | + |
|
73 | + $userProfile->identifier = $user->get('id'); |
|
74 | + $userProfile->displayName = $user->get('display_name'); |
|
75 | + $userProfile->photoURL = $user->get('profile_image_url'); |
|
76 | + $userProfile->email = $user->get('email'); |
|
77 | + $userProfile->description = strip_tags($user->get('description')); |
|
78 | + $userProfile->profileURL = "https://www.twitch.tv/{$userProfile->displayName}"; |
|
79 | + |
|
80 | + return $userProfile; |
|
81 | + } |
|
82 | 82 | } |
@@ -12,23 +12,23 @@ |
||
12 | 12 | */ |
13 | 13 | class WeChatChina extends WeChat |
14 | 14 | { |
15 | - /** |
|
16 | - * {@inheritdoc} |
|
17 | - */ |
|
18 | - protected $apiBaseUrl = 'https://api.weixin.qq.com/sns/'; |
|
15 | + /** |
|
16 | + * {@inheritdoc} |
|
17 | + */ |
|
18 | + protected $apiBaseUrl = 'https://api.weixin.qq.com/sns/'; |
|
19 | 19 | |
20 | - /** |
|
21 | - * {@inheritdoc} |
|
22 | - */ |
|
23 | - protected $accessTokenUrl = 'https://api.weixin.qq.com/sns/oauth2/access_token'; |
|
20 | + /** |
|
21 | + * {@inheritdoc} |
|
22 | + */ |
|
23 | + protected $accessTokenUrl = 'https://api.weixin.qq.com/sns/oauth2/access_token'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * {@inheritdoc} |
|
27 | - */ |
|
28 | - protected $tokenRefreshUrl = 'https://api.weixin.qq.com/sns/oauth2/refresh_token'; |
|
25 | + /** |
|
26 | + * {@inheritdoc} |
|
27 | + */ |
|
28 | + protected $tokenRefreshUrl = 'https://api.weixin.qq.com/sns/oauth2/refresh_token'; |
|
29 | 29 | |
30 | - /** |
|
31 | - * {@ịnheritdoc} |
|
32 | - */ |
|
33 | - protected $accessTokenInfoUrl = 'https://api.weixin.qq.com/sns/auth'; |
|
30 | + /** |
|
31 | + * {@ịnheritdoc} |
|
32 | + */ |
|
33 | + protected $accessTokenInfoUrl = 'https://api.weixin.qq.com/sns/auth'; |
|
34 | 34 | } |
@@ -17,84 +17,84 @@ |
||
17 | 17 | */ |
18 | 18 | class Slack extends OAuth2 |
19 | 19 | { |
20 | - /** |
|
21 | - * {@inheritdoc} |
|
22 | - */ |
|
23 | - protected $scope = 'identity.basic identity.email identity.avatar'; |
|
20 | + /** |
|
21 | + * {@inheritdoc} |
|
22 | + */ |
|
23 | + protected $scope = 'identity.basic identity.email identity.avatar'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * {@inheritdoc} |
|
27 | - */ |
|
28 | - protected $apiBaseUrl = 'https://slack.com/'; |
|
25 | + /** |
|
26 | + * {@inheritdoc} |
|
27 | + */ |
|
28 | + protected $apiBaseUrl = 'https://slack.com/'; |
|
29 | 29 | |
30 | - /** |
|
31 | - * {@inheritdoc} |
|
32 | - */ |
|
33 | - protected $authorizeUrl = 'https://slack.com/oauth/authorize'; |
|
30 | + /** |
|
31 | + * {@inheritdoc} |
|
32 | + */ |
|
33 | + protected $authorizeUrl = 'https://slack.com/oauth/authorize'; |
|
34 | 34 | |
35 | - /** |
|
36 | - * {@inheritdoc} |
|
37 | - */ |
|
38 | - protected $accessTokenUrl = 'https://slack.com/api/oauth.access'; |
|
35 | + /** |
|
36 | + * {@inheritdoc} |
|
37 | + */ |
|
38 | + protected $accessTokenUrl = 'https://slack.com/api/oauth.access'; |
|
39 | 39 | |
40 | - /** |
|
41 | - * {@inheritdoc} |
|
42 | - */ |
|
43 | - protected $apiDocumentation = 'https://api.slack.com/docs/sign-in-with-slack'; |
|
40 | + /** |
|
41 | + * {@inheritdoc} |
|
42 | + */ |
|
43 | + protected $apiDocumentation = 'https://api.slack.com/docs/sign-in-with-slack'; |
|
44 | 44 | |
45 | - /** |
|
46 | - * {@inheritdoc} |
|
47 | - */ |
|
48 | - public function getUserProfile() |
|
49 | - { |
|
50 | - $response = $this->apiRequest('api/users.identity'); |
|
45 | + /** |
|
46 | + * {@inheritdoc} |
|
47 | + */ |
|
48 | + public function getUserProfile() |
|
49 | + { |
|
50 | + $response = $this->apiRequest('api/users.identity'); |
|
51 | 51 | |
52 | - $data = new Data\Collection($response); |
|
52 | + $data = new Data\Collection($response); |
|
53 | 53 | |
54 | - if (!$data->exists('ok') || !$data->get('ok')) { |
|
55 | - throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
56 | - } |
|
54 | + if (!$data->exists('ok') || !$data->get('ok')) { |
|
55 | + throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
56 | + } |
|
57 | 57 | |
58 | - $userProfile = new User\Profile(); |
|
58 | + $userProfile = new User\Profile(); |
|
59 | 59 | |
60 | - $userProfile->identifier = $data->filter('user')->get('id'); |
|
61 | - $userProfile->displayName = $data->filter('user')->get('name'); |
|
62 | - $userProfile->email = $data->filter('user')->get('email'); |
|
63 | - $userProfile->photoURL = $this->findLargestImage($data); |
|
60 | + $userProfile->identifier = $data->filter('user')->get('id'); |
|
61 | + $userProfile->displayName = $data->filter('user')->get('name'); |
|
62 | + $userProfile->email = $data->filter('user')->get('email'); |
|
63 | + $userProfile->photoURL = $this->findLargestImage($data); |
|
64 | 64 | |
65 | - return $userProfile; |
|
66 | - } |
|
65 | + return $userProfile; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Returns the url of the image with the highest resolution in the user |
|
70 | - * object. |
|
71 | - * |
|
72 | - * Slack sends multiple image urls with different resolutions. As they make |
|
73 | - * no guarantees which resolutions will be included we have to search all |
|
74 | - * <code>image_*</code> properties for the one with the highest resolution. |
|
75 | - * The resolution is attached to the property name such as |
|
76 | - * <code>image_32</code> or <code>image_192</code>. |
|
77 | - * |
|
78 | - * @param Data\Collection $data response object as returned by |
|
79 | - * <code>api/users.identity</code> |
|
80 | - * |
|
81 | - * @return string|null the value of the <code>image_*</code> property with |
|
82 | - * the highest resolution. |
|
83 | - */ |
|
84 | - private function findLargestImage(Data\Collection $data) |
|
85 | - { |
|
86 | - $maxSize = 0; |
|
87 | - foreach ($data->filter('user')->properties() as $property) { |
|
88 | - if (preg_match('/^image_(\d+)$/', $property, $matches) === 1) { |
|
89 | - $availableSize = (int)$matches[1]; |
|
90 | - if ($maxSize < $availableSize) { |
|
91 | - $maxSize = $availableSize; |
|
92 | - } |
|
93 | - } |
|
94 | - } |
|
95 | - if ($maxSize > 0) { |
|
96 | - return $data->filter('user')->get('image_' . $maxSize); |
|
97 | - } |
|
98 | - return null; |
|
99 | - } |
|
68 | + /** |
|
69 | + * Returns the url of the image with the highest resolution in the user |
|
70 | + * object. |
|
71 | + * |
|
72 | + * Slack sends multiple image urls with different resolutions. As they make |
|
73 | + * no guarantees which resolutions will be included we have to search all |
|
74 | + * <code>image_*</code> properties for the one with the highest resolution. |
|
75 | + * The resolution is attached to the property name such as |
|
76 | + * <code>image_32</code> or <code>image_192</code>. |
|
77 | + * |
|
78 | + * @param Data\Collection $data response object as returned by |
|
79 | + * <code>api/users.identity</code> |
|
80 | + * |
|
81 | + * @return string|null the value of the <code>image_*</code> property with |
|
82 | + * the highest resolution. |
|
83 | + */ |
|
84 | + private function findLargestImage(Data\Collection $data) |
|
85 | + { |
|
86 | + $maxSize = 0; |
|
87 | + foreach ($data->filter('user')->properties() as $property) { |
|
88 | + if (preg_match('/^image_(\d+)$/', $property, $matches) === 1) { |
|
89 | + $availableSize = (int)$matches[1]; |
|
90 | + if ($maxSize < $availableSize) { |
|
91 | + $maxSize = $availableSize; |
|
92 | + } |
|
93 | + } |
|
94 | + } |
|
95 | + if ($maxSize > 0) { |
|
96 | + return $data->filter('user')->get('image_' . $maxSize); |
|
97 | + } |
|
98 | + return null; |
|
99 | + } |
|
100 | 100 | } |
@@ -17,80 +17,80 @@ |
||
17 | 17 | */ |
18 | 18 | class Discord extends OAuth2 |
19 | 19 | { |
20 | - /** |
|
21 | - * {@inheritdoc} |
|
22 | - */ |
|
23 | - protected $scope = 'identify email'; |
|
24 | - |
|
25 | - /** |
|
26 | - * {@inheritdoc} |
|
27 | - */ |
|
28 | - protected $apiBaseUrl = 'https://discordapp.com/api/'; |
|
29 | - |
|
30 | - /** |
|
31 | - * {@inheritdoc} |
|
32 | - */ |
|
33 | - protected $authorizeUrl = 'https://discordapp.com/api/oauth2/authorize'; |
|
34 | - |
|
35 | - /** |
|
36 | - * {@inheritdoc} |
|
37 | - */ |
|
38 | - protected $accessTokenUrl = 'https://discordapp.com/api/oauth2/token'; |
|
39 | - |
|
40 | - /** |
|
41 | - * {@inheritdoc} |
|
42 | - */ |
|
43 | - protected $apiDocumentation = 'https://discordapp.com/developers/docs/topics/oauth2'; |
|
44 | - |
|
45 | - /** |
|
46 | - * {@inheritdoc} |
|
47 | - */ |
|
48 | - protected function initialize() |
|
49 | - { |
|
50 | - parent::initialize(); |
|
51 | - |
|
52 | - if ($this->isRefreshTokenAvailable()) { |
|
53 | - $this->tokenRefreshParameters += [ |
|
54 | - 'client_id' => $this->clientId, |
|
55 | - 'client_secret' => $this->clientSecret, |
|
56 | - ]; |
|
57 | - } |
|
58 | - } |
|
59 | - |
|
60 | - /** |
|
61 | - * {@inheritdoc} |
|
62 | - */ |
|
63 | - public function getUserProfile() |
|
64 | - { |
|
65 | - $response = $this->apiRequest('users/@me'); |
|
66 | - |
|
67 | - $data = new Data\Collection($response); |
|
68 | - |
|
69 | - if (!$data->exists('id')) { |
|
70 | - throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
71 | - } |
|
72 | - |
|
73 | - // Makes display name more unique. |
|
74 | - $displayName = $data->get('username') ?: $data->get('login'); |
|
75 | - if ($discriminator = $data->get('discriminator')) { |
|
76 | - $displayName .= "#{$discriminator}"; |
|
77 | - } |
|
78 | - |
|
79 | - $userProfile = new User\Profile(); |
|
80 | - |
|
81 | - $userProfile->identifier = $data->get('id'); |
|
82 | - $userProfile->displayName = $displayName; |
|
83 | - $userProfile->email = $data->get('email'); |
|
84 | - |
|
85 | - if ($data->get('verified')) { |
|
86 | - $userProfile->emailVerified = $data->get('email'); |
|
87 | - } |
|
88 | - |
|
89 | - if ($data->get('avatar')) { |
|
90 | - $userProfile->photoURL = 'https://cdn.discordapp.com/avatars/'; |
|
91 | - $userProfile->photoURL .= $data->get('id') . '/' . $data->get('avatar') . '.png'; |
|
92 | - } |
|
93 | - |
|
94 | - return $userProfile; |
|
95 | - } |
|
20 | + /** |
|
21 | + * {@inheritdoc} |
|
22 | + */ |
|
23 | + protected $scope = 'identify email'; |
|
24 | + |
|
25 | + /** |
|
26 | + * {@inheritdoc} |
|
27 | + */ |
|
28 | + protected $apiBaseUrl = 'https://discordapp.com/api/'; |
|
29 | + |
|
30 | + /** |
|
31 | + * {@inheritdoc} |
|
32 | + */ |
|
33 | + protected $authorizeUrl = 'https://discordapp.com/api/oauth2/authorize'; |
|
34 | + |
|
35 | + /** |
|
36 | + * {@inheritdoc} |
|
37 | + */ |
|
38 | + protected $accessTokenUrl = 'https://discordapp.com/api/oauth2/token'; |
|
39 | + |
|
40 | + /** |
|
41 | + * {@inheritdoc} |
|
42 | + */ |
|
43 | + protected $apiDocumentation = 'https://discordapp.com/developers/docs/topics/oauth2'; |
|
44 | + |
|
45 | + /** |
|
46 | + * {@inheritdoc} |
|
47 | + */ |
|
48 | + protected function initialize() |
|
49 | + { |
|
50 | + parent::initialize(); |
|
51 | + |
|
52 | + if ($this->isRefreshTokenAvailable()) { |
|
53 | + $this->tokenRefreshParameters += [ |
|
54 | + 'client_id' => $this->clientId, |
|
55 | + 'client_secret' => $this->clientSecret, |
|
56 | + ]; |
|
57 | + } |
|
58 | + } |
|
59 | + |
|
60 | + /** |
|
61 | + * {@inheritdoc} |
|
62 | + */ |
|
63 | + public function getUserProfile() |
|
64 | + { |
|
65 | + $response = $this->apiRequest('users/@me'); |
|
66 | + |
|
67 | + $data = new Data\Collection($response); |
|
68 | + |
|
69 | + if (!$data->exists('id')) { |
|
70 | + throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
71 | + } |
|
72 | + |
|
73 | + // Makes display name more unique. |
|
74 | + $displayName = $data->get('username') ?: $data->get('login'); |
|
75 | + if ($discriminator = $data->get('discriminator')) { |
|
76 | + $displayName .= "#{$discriminator}"; |
|
77 | + } |
|
78 | + |
|
79 | + $userProfile = new User\Profile(); |
|
80 | + |
|
81 | + $userProfile->identifier = $data->get('id'); |
|
82 | + $userProfile->displayName = $displayName; |
|
83 | + $userProfile->email = $data->get('email'); |
|
84 | + |
|
85 | + if ($data->get('verified')) { |
|
86 | + $userProfile->emailVerified = $data->get('email'); |
|
87 | + } |
|
88 | + |
|
89 | + if ($data->get('avatar')) { |
|
90 | + $userProfile->photoURL = 'https://cdn.discordapp.com/avatars/'; |
|
91 | + $userProfile->photoURL .= $data->get('id') . '/' . $data->get('avatar') . '.png'; |
|
92 | + } |
|
93 | + |
|
94 | + return $userProfile; |
|
95 | + } |
|
96 | 96 | } |
@@ -12,39 +12,39 @@ |
||
12 | 12 | */ |
13 | 13 | interface LoggerInterface |
14 | 14 | { |
15 | - /** |
|
16 | - * Interesting events. |
|
17 | - * |
|
18 | - * Example: User logs in, SQL logs. |
|
19 | - * |
|
20 | - * @param string $message |
|
21 | - * @param array $context |
|
22 | - */ |
|
23 | - public function info($message, array $context = array()); |
|
15 | + /** |
|
16 | + * Interesting events. |
|
17 | + * |
|
18 | + * Example: User logs in, SQL logs. |
|
19 | + * |
|
20 | + * @param string $message |
|
21 | + * @param array $context |
|
22 | + */ |
|
23 | + public function info($message, array $context = array()); |
|
24 | 24 | |
25 | - /** |
|
26 | - * Detailed debug information. |
|
27 | - * |
|
28 | - * @param string $message |
|
29 | - * @param array $context |
|
30 | - */ |
|
31 | - public function debug($message, array $context = array()); |
|
25 | + /** |
|
26 | + * Detailed debug information. |
|
27 | + * |
|
28 | + * @param string $message |
|
29 | + * @param array $context |
|
30 | + */ |
|
31 | + public function debug($message, array $context = array()); |
|
32 | 32 | |
33 | - /** |
|
34 | - * Runtime errors that do not require immediate action but should typically |
|
35 | - * be logged and monitored. |
|
36 | - * |
|
37 | - * @param string $message |
|
38 | - * @param array $context |
|
39 | - */ |
|
40 | - public function error($message, array $context = array()); |
|
33 | + /** |
|
34 | + * Runtime errors that do not require immediate action but should typically |
|
35 | + * be logged and monitored. |
|
36 | + * |
|
37 | + * @param string $message |
|
38 | + * @param array $context |
|
39 | + */ |
|
40 | + public function error($message, array $context = array()); |
|
41 | 41 | |
42 | - /** |
|
43 | - * Logs with an arbitrary level. |
|
44 | - * |
|
45 | - * @param mixed $level |
|
46 | - * @param string $message |
|
47 | - * @param array $context |
|
48 | - */ |
|
49 | - public function log($level, $message, array $context = array()); |
|
42 | + /** |
|
43 | + * Logs with an arbitrary level. |
|
44 | + * |
|
45 | + * @param mixed $level |
|
46 | + * @param string $message |
|
47 | + * @param array $context |
|
48 | + */ |
|
49 | + public function log($level, $message, array $context = array()); |
|
50 | 50 | } |