Passed
Push — master ( 14fbd7...a7a005 )
by
unknown
55s queued 15s
created
src/Exception/ExceptionInterface.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Logger/Psr3LoggerWrapper.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -14,37 +14,37 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Provider/BlizzardAPAC.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -17,18 +17,18 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Provider/BlizzardEU.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -17,18 +17,18 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Provider/TwitchTV.php 1 patch
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -17,66 +17,66 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Provider/WeChatChina.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -12,23 +12,23 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Provider/Slack.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -17,84 +17,84 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Provider/GitHub.php 1 patch
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -17,94 +17,94 @@
 block discarded – undo
17 17
  */
18 18
 class GitHub extends OAuth2
19 19
 {
20
-    /**
21
-     * {@inheritdoc}
22
-     */
23
-    protected $scope = 'user:email';
24
-
25
-    /**
26
-     * {@inheritdoc}
27
-     */
28
-    protected $apiBaseUrl = 'https://api.github.com/';
29
-
30
-    /**
31
-     * {@inheritdoc}
32
-     */
33
-    protected $authorizeUrl = 'https://github.com/login/oauth/authorize';
34
-
35
-    /**
36
-     * {@inheritdoc}
37
-     */
38
-    protected $accessTokenUrl = 'https://github.com/login/oauth/access_token';
39
-
40
-    /**
41
-     * {@inheritdoc}
42
-     */
43
-    protected $apiDocumentation = 'https://developer.github.com/v3/oauth/';
44
-
45
-    /**
46
-     * {@inheritdoc}
47
-     */
48
-    public function getUserProfile()
49
-    {
50
-        $response = $this->apiRequest('user');
51
-
52
-        $data = new Data\Collection($response);
53
-
54
-        if (!$data->exists('id')) {
55
-            throw new UnexpectedApiResponseException('Provider API returned an unexpected response.');
56
-        }
57
-
58
-        $userProfile = new User\Profile();
59
-
60
-        $userProfile->identifier = $data->get('id');
61
-        $userProfile->displayName = $data->get('name');
62
-        $userProfile->description = $data->get('bio');
63
-        $userProfile->photoURL = $data->get('avatar_url');
64
-        $userProfile->profileURL = $data->get('html_url');
65
-        $userProfile->email = $data->get('email');
66
-        $userProfile->webSiteURL = $data->get('blog');
67
-        $userProfile->region = $data->get('location');
68
-
69
-        $userProfile->displayName = $userProfile->displayName ?: $data->get('login');
70
-
71
-        if (empty($userProfile->email) && strpos($this->scope, 'user:email') !== false) {
72
-            try {
73
-                // user email is not mandatory so keep it quite.
74
-                $userProfile = $this->requestUserEmail($userProfile);
75
-            } catch (\Exception $e) {
76
-            }
77
-        }
78
-
79
-        return $userProfile;
80
-    }
81
-
82
-    /**
83
-     * Request connected user email
84
-     *
85
-     * https://developer.github.com/v3/users/emails/
86
-     * @param User\Profile $userProfile
87
-     *
88
-     * @return User\Profile
89
-     *
90
-     * @throws \Exception
91
-     */
92
-    protected function requestUserEmail(User\Profile $userProfile)
93
-    {
94
-        $response = $this->apiRequest('user/emails');
95
-
96
-        foreach ($response as $idx => $item) {
97
-            if (!empty($item->primary) && $item->primary == 1) {
98
-                $userProfile->email = $item->email;
99
-
100
-                if (!empty($item->verified) && $item->verified == 1) {
101
-                    $userProfile->emailVerified = $userProfile->email;
102
-                }
103
-
104
-                break;
105
-            }
106
-        }
107
-
108
-        return $userProfile;
109
-    }
20
+	/**
21
+	 * {@inheritdoc}
22
+	 */
23
+	protected $scope = 'user:email';
24
+
25
+	/**
26
+	 * {@inheritdoc}
27
+	 */
28
+	protected $apiBaseUrl = 'https://api.github.com/';
29
+
30
+	/**
31
+	 * {@inheritdoc}
32
+	 */
33
+	protected $authorizeUrl = 'https://github.com/login/oauth/authorize';
34
+
35
+	/**
36
+	 * {@inheritdoc}
37
+	 */
38
+	protected $accessTokenUrl = 'https://github.com/login/oauth/access_token';
39
+
40
+	/**
41
+	 * {@inheritdoc}
42
+	 */
43
+	protected $apiDocumentation = 'https://developer.github.com/v3/oauth/';
44
+
45
+	/**
46
+	 * {@inheritdoc}
47
+	 */
48
+	public function getUserProfile()
49
+	{
50
+		$response = $this->apiRequest('user');
51
+
52
+		$data = new Data\Collection($response);
53
+
54
+		if (!$data->exists('id')) {
55
+			throw new UnexpectedApiResponseException('Provider API returned an unexpected response.');
56
+		}
57
+
58
+		$userProfile = new User\Profile();
59
+
60
+		$userProfile->identifier = $data->get('id');
61
+		$userProfile->displayName = $data->get('name');
62
+		$userProfile->description = $data->get('bio');
63
+		$userProfile->photoURL = $data->get('avatar_url');
64
+		$userProfile->profileURL = $data->get('html_url');
65
+		$userProfile->email = $data->get('email');
66
+		$userProfile->webSiteURL = $data->get('blog');
67
+		$userProfile->region = $data->get('location');
68
+
69
+		$userProfile->displayName = $userProfile->displayName ?: $data->get('login');
70
+
71
+		if (empty($userProfile->email) && strpos($this->scope, 'user:email') !== false) {
72
+			try {
73
+				// user email is not mandatory so keep it quite.
74
+				$userProfile = $this->requestUserEmail($userProfile);
75
+			} catch (\Exception $e) {
76
+			}
77
+		}
78
+
79
+		return $userProfile;
80
+	}
81
+
82
+	/**
83
+	 * Request connected user email
84
+	 *
85
+	 * https://developer.github.com/v3/users/emails/
86
+	 * @param User\Profile $userProfile
87
+	 *
88
+	 * @return User\Profile
89
+	 *
90
+	 * @throws \Exception
91
+	 */
92
+	protected function requestUserEmail(User\Profile $userProfile)
93
+	{
94
+		$response = $this->apiRequest('user/emails');
95
+
96
+		foreach ($response as $idx => $item) {
97
+			if (!empty($item->primary) && $item->primary == 1) {
98
+				$userProfile->email = $item->email;
99
+
100
+				if (!empty($item->verified) && $item->verified == 1) {
101
+					$userProfile->emailVerified = $userProfile->email;
102
+				}
103
+
104
+				break;
105
+			}
106
+		}
107
+
108
+		return $userProfile;
109
+	}
110 110
 }
Please login to merge, or discard this patch.
src/Provider/Discord.php 1 patch
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -17,80 +17,80 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.