Passed
Push — master ( bd5724...8a312b )
by
unknown
01:47
created
src/Provider/GitLab.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -17,56 +17,56 @@
 block discarded – undo
17 17
  */
18 18
 class GitLab extends OAuth2
19 19
 {
20
-    /**
21
-     * {@inheritdoc}
22
-     */
23
-    protected $scope = 'api';
20
+	/**
21
+	 * {@inheritdoc}
22
+	 */
23
+	protected $scope = 'api';
24 24
 
25
-    /**
26
-     * {@inheritdoc}
27
-     */
28
-    protected $apiBaseUrl = 'https://gitlab.com/api/v3/';
25
+	/**
26
+	 * {@inheritdoc}
27
+	 */
28
+	protected $apiBaseUrl = 'https://gitlab.com/api/v3/';
29 29
 
30
-    /**
31
-     * {@inheritdoc}
32
-     */
33
-    protected $authorizeUrl = 'https://gitlab.com/oauth/authorize';
30
+	/**
31
+	 * {@inheritdoc}
32
+	 */
33
+	protected $authorizeUrl = 'https://gitlab.com/oauth/authorize';
34 34
 
35
-    /**
36
-     * {@inheritdoc}
37
-     */
38
-    protected $accessTokenUrl = 'https://gitlab.com/oauth/token';
35
+	/**
36
+	 * {@inheritdoc}
37
+	 */
38
+	protected $accessTokenUrl = 'https://gitlab.com/oauth/token';
39 39
 
40
-    /**
41
-     * {@inheritdoc}
42
-     */
43
-    protected $apiDocumentation = 'https://docs.gitlab.com/ee/api/oauth2.html';
40
+	/**
41
+	 * {@inheritdoc}
42
+	 */
43
+	protected $apiDocumentation = 'https://docs.gitlab.com/ee/api/oauth2.html';
44 44
 
45
-    /**
46
-     * {@inheritdoc}
47
-     */
48
-    public function getUserProfile()
49
-    {
50
-        $response = $this->apiRequest('user');
45
+	/**
46
+	 * {@inheritdoc}
47
+	 */
48
+	public function getUserProfile()
49
+	{
50
+		$response = $this->apiRequest('user');
51 51
 
52
-        $data = new Data\Collection($response);
52
+		$data = new Data\Collection($response);
53 53
 
54
-        if (!$data->exists('id')) {
55
-            throw new UnexpectedApiResponseException('Provider API returned an unexpected response.');
56
-        }
54
+		if (!$data->exists('id')) {
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->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('web_url');
65
-        $userProfile->email = $data->get('email');
66
-        $userProfile->webSiteURL = $data->get('website_url');
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('web_url');
65
+		$userProfile->email = $data->get('email');
66
+		$userProfile->webSiteURL = $data->get('website_url');
67 67
 
68
-        $userProfile->displayName = $userProfile->displayName ?: $data->get('username');
68
+		$userProfile->displayName = $userProfile->displayName ?: $data->get('username');
69 69
 
70
-        return $userProfile;
71
-    }
70
+		return $userProfile;
71
+	}
72 72
 }
Please login to merge, or discard this patch.
src/Provider/Foursquare.php 1 patch
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -17,124 +17,124 @@
 block discarded – undo
17 17
  */
18 18
 class Foursquare extends OAuth2
19 19
 {
20
-    /**
21
-     * {@inheritdoc}
22
-     */
23
-    protected $apiBaseUrl = 'https://api.foursquare.com/v2/';
24
-
25
-    /**
26
-     * {@inheritdoc}
27
-     */
28
-    protected $authorizeUrl = 'https://foursquare.com/oauth2/authenticate';
29
-
30
-    /**
31
-     * {@inheritdoc}
32
-     */
33
-    protected $accessTokenUrl = 'https://foursquare.com/oauth2/access_token';
34
-
35
-    /**
36
-     * {@inheritdoc}
37
-     */
38
-    protected $accessTokenName = 'oauth_token';
39
-
40
-    /**
41
-     * {@inheritdoc}
42
-     */
43
-    protected $apiDocumentation = 'https://developer.foursquare.com/overview/auth';
44
-
45
-    /**
46
-     * {@inheritdoc}
47
-     */
48
-    protected function initialize()
49
-    {
50
-        parent::initialize();
51
-
52
-        $apiVersion = $this->config->get('api_version') ?: '20140201';
53
-
54
-        $this->apiRequestParameters = [
55
-            'oauth_token' => $this->getStoredData('access_token'),
56
-            'v' => $apiVersion,
57
-        ];
58
-    }
59
-
60
-    /**
61
-     * {@inheritdoc}
62
-     */
63
-    public function getUserProfile()
64
-    {
65
-        $response = $this->apiRequest('users/self');
66
-
67
-        $data = new Data\Collection($response);
68
-
69
-        if (!$data->exists('response')) {
70
-            throw new UnexpectedApiResponseException('Provider API returned an unexpected response.');
71
-        }
72
-
73
-        $userProfile = new User\Profile();
74
-
75
-        $data = $data->filter('response')->filter('user');
76
-
77
-        $userProfile->identifier = $data->get('id');
78
-        $userProfile->firstName = $data->get('firstName');
79
-        $userProfile->lastName = $data->get('lastName');
80
-        $userProfile->gender = $data->get('gender');
81
-        $userProfile->city = $data->get('homeCity');
82
-        $userProfile->email = $data->filter('contact')->get('email');
83
-        $userProfile->emailVerified = $userProfile->email;
84
-        $userProfile->profileURL = 'https://www.foursquare.com/user/' . $userProfile->identifier;
85
-        $userProfile->displayName = trim($userProfile->firstName . ' ' . $userProfile->lastName);
86
-
87
-        if ($data->exists('photo')) {
88
-            $photoSize = $this->config->get('photo_size') ?: '150x150';
89
-
90
-            $userProfile->photoURL = $data->filter('photo')->get('prefix');
91
-            $userProfile->photoURL .= $photoSize . $data->filter('photo')->get('suffix');
92
-        }
93
-
94
-        return $userProfile;
95
-    }
96
-
97
-    /**
98
-     * {@inheritdoc}
99
-     */
100
-    public function getUserContacts()
101
-    {
102
-        $response = $this->apiRequest('users/self/friends');
103
-
104
-        $data = new Data\Collection($response);
105
-
106
-        if (!$data->exists('response')) {
107
-            throw new UnexpectedApiResponseException('Provider API returned an unexpected response.');
108
-        }
109
-
110
-        $contacts = [];
111
-
112
-        foreach ($data->filter('response')->filter('friends')->filter('items')->toArray() as $item) {
113
-            $contacts[] = $this->fetchUserContact($item);
114
-        }
115
-
116
-        return $contacts;
117
-    }
118
-
119
-    /**
120
-     * @param $item
121
-     *
122
-     * @return User\Contact
123
-     */
124
-    protected function fetchUserContact($item)
125
-    {
126
-        $photoSize = $this->config->get('photo_size') ?: '150x150';
127
-
128
-        $item = new Data\Collection($item);
129
-
130
-        $userContact = new User\Contact();
131
-
132
-        $userContact->identifier = $item->get('id');
133
-        $userContact->photoURL = $item->filter('photo')->get('prefix');
134
-        $userContact->photoURL .= $photoSize . $item->filter('photo')->get('suffix');
135
-        $userContact->displayName = trim($item->get('firstName') . ' ' . $item->get('lastName'));
136
-        $userContact->email = $item->filter('contact')->get('email');
137
-
138
-        return $userContact;
139
-    }
20
+	/**
21
+	 * {@inheritdoc}
22
+	 */
23
+	protected $apiBaseUrl = 'https://api.foursquare.com/v2/';
24
+
25
+	/**
26
+	 * {@inheritdoc}
27
+	 */
28
+	protected $authorizeUrl = 'https://foursquare.com/oauth2/authenticate';
29
+
30
+	/**
31
+	 * {@inheritdoc}
32
+	 */
33
+	protected $accessTokenUrl = 'https://foursquare.com/oauth2/access_token';
34
+
35
+	/**
36
+	 * {@inheritdoc}
37
+	 */
38
+	protected $accessTokenName = 'oauth_token';
39
+
40
+	/**
41
+	 * {@inheritdoc}
42
+	 */
43
+	protected $apiDocumentation = 'https://developer.foursquare.com/overview/auth';
44
+
45
+	/**
46
+	 * {@inheritdoc}
47
+	 */
48
+	protected function initialize()
49
+	{
50
+		parent::initialize();
51
+
52
+		$apiVersion = $this->config->get('api_version') ?: '20140201';
53
+
54
+		$this->apiRequestParameters = [
55
+			'oauth_token' => $this->getStoredData('access_token'),
56
+			'v' => $apiVersion,
57
+		];
58
+	}
59
+
60
+	/**
61
+	 * {@inheritdoc}
62
+	 */
63
+	public function getUserProfile()
64
+	{
65
+		$response = $this->apiRequest('users/self');
66
+
67
+		$data = new Data\Collection($response);
68
+
69
+		if (!$data->exists('response')) {
70
+			throw new UnexpectedApiResponseException('Provider API returned an unexpected response.');
71
+		}
72
+
73
+		$userProfile = new User\Profile();
74
+
75
+		$data = $data->filter('response')->filter('user');
76
+
77
+		$userProfile->identifier = $data->get('id');
78
+		$userProfile->firstName = $data->get('firstName');
79
+		$userProfile->lastName = $data->get('lastName');
80
+		$userProfile->gender = $data->get('gender');
81
+		$userProfile->city = $data->get('homeCity');
82
+		$userProfile->email = $data->filter('contact')->get('email');
83
+		$userProfile->emailVerified = $userProfile->email;
84
+		$userProfile->profileURL = 'https://www.foursquare.com/user/' . $userProfile->identifier;
85
+		$userProfile->displayName = trim($userProfile->firstName . ' ' . $userProfile->lastName);
86
+
87
+		if ($data->exists('photo')) {
88
+			$photoSize = $this->config->get('photo_size') ?: '150x150';
89
+
90
+			$userProfile->photoURL = $data->filter('photo')->get('prefix');
91
+			$userProfile->photoURL .= $photoSize . $data->filter('photo')->get('suffix');
92
+		}
93
+
94
+		return $userProfile;
95
+	}
96
+
97
+	/**
98
+	 * {@inheritdoc}
99
+	 */
100
+	public function getUserContacts()
101
+	{
102
+		$response = $this->apiRequest('users/self/friends');
103
+
104
+		$data = new Data\Collection($response);
105
+
106
+		if (!$data->exists('response')) {
107
+			throw new UnexpectedApiResponseException('Provider API returned an unexpected response.');
108
+		}
109
+
110
+		$contacts = [];
111
+
112
+		foreach ($data->filter('response')->filter('friends')->filter('items')->toArray() as $item) {
113
+			$contacts[] = $this->fetchUserContact($item);
114
+		}
115
+
116
+		return $contacts;
117
+	}
118
+
119
+	/**
120
+	 * @param $item
121
+	 *
122
+	 * @return User\Contact
123
+	 */
124
+	protected function fetchUserContact($item)
125
+	{
126
+		$photoSize = $this->config->get('photo_size') ?: '150x150';
127
+
128
+		$item = new Data\Collection($item);
129
+
130
+		$userContact = new User\Contact();
131
+
132
+		$userContact->identifier = $item->get('id');
133
+		$userContact->photoURL = $item->filter('photo')->get('prefix');
134
+		$userContact->photoURL .= $photoSize . $item->filter('photo')->get('suffix');
135
+		$userContact->displayName = trim($item->get('firstName') . ' ' . $item->get('lastName'));
136
+		$userContact->email = $item->filter('contact')->get('email');
137
+
138
+		return $userContact;
139
+	}
140 140
 }
Please login to merge, or discard this patch.
src/Provider/StackExchangeOpenID.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -14,29 +14,29 @@
 block discarded – undo
14 14
  */
15 15
 class StackExchangeOpenID extends OpenID
16 16
 {
17
-    /**
18
-     * {@inheritdoc}
19
-     */
20
-    protected $openidIdentifier = 'https://openid.stackexchange.com/';
21
-
22
-    /**
23
-     * {@inheritdoc}
24
-     */
25
-    protected $apiDocumentation = 'https://openid.stackexchange.com/';
26
-
27
-    /**
28
-     * {@inheritdoc}
29
-     */
30
-    public function authenticateFinish()
31
-    {
32
-        parent::authenticateFinish();
33
-
34
-        $userProfile = $this->storage->get($this->providerId . '.user');
35
-
36
-        $userProfile->identifier = !empty($userProfile->identifier) ? $userProfile->identifier : $userProfile->email;
37
-        $userProfile->emailVerified = $userProfile->email;
38
-
39
-        // re store the user profile
40
-        $this->storage->set($this->providerId . '.user', $userProfile);
41
-    }
17
+	/**
18
+	 * {@inheritdoc}
19
+	 */
20
+	protected $openidIdentifier = 'https://openid.stackexchange.com/';
21
+
22
+	/**
23
+	 * {@inheritdoc}
24
+	 */
25
+	protected $apiDocumentation = 'https://openid.stackexchange.com/';
26
+
27
+	/**
28
+	 * {@inheritdoc}
29
+	 */
30
+	public function authenticateFinish()
31
+	{
32
+		parent::authenticateFinish();
33
+
34
+		$userProfile = $this->storage->get($this->providerId . '.user');
35
+
36
+		$userProfile->identifier = !empty($userProfile->identifier) ? $userProfile->identifier : $userProfile->email;
37
+		$userProfile->emailVerified = $userProfile->email;
38
+
39
+		// re store the user profile
40
+		$this->storage->set($this->providerId . '.user', $userProfile);
41
+	}
42 42
 }
Please login to merge, or discard this patch.
src/Provider/StackExchange.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -38,70 +38,70 @@
 block discarded – undo
38 38
  */
39 39
 class StackExchange extends OAuth2
40 40
 {
41
-    /**
42
-     * {@inheritdoc}
43
-     */
44
-    protected $scope = null;
45
-
46
-    /**
47
-     * {@inheritdoc}
48
-     */
49
-    protected $apiBaseUrl = 'https://api.stackexchange.com/2.2/';
50
-
51
-    /**
52
-     * {@inheritdoc}
53
-     */
54
-    protected $authorizeUrl = 'https://stackexchange.com/oauth';
55
-
56
-    /**
57
-     * {@inheritdoc}
58
-     */
59
-    protected $accessTokenUrl = 'https://stackexchange.com/oauth/access_token';
60
-
61
-    /**
62
-     * {@inheritdoc}
63
-     */
64
-    protected $apiDocumentation = 'https://api.stackexchange.com/docs/authentication';
65
-
66
-    /**
67
-     * {@inheritdoc}
68
-     */
69
-    protected function initialize()
70
-    {
71
-        parent::initialize();
72
-
73
-        $apiKey = $this->config->get('api_key');
74
-
75
-        $this->apiRequestParameters = ['key' => $apiKey];
76
-    }
77
-
78
-    /**
79
-     * {@inheritdoc}
80
-     */
81
-    public function getUserProfile()
82
-    {
83
-        $site = $this->config->get('site');
84
-
85
-        $response = $this->apiRequest('me', 'GET', [
86
-            'site' => $site,
87
-            'access_token' => $this->getStoredData('access_token'),
88
-        ]);
89
-
90
-        if (!$response || !isset($response->items) || !isset($response->items[0])) {
91
-            throw new UnexpectedApiResponseException('Provider API returned an unexpected response.');
92
-        }
93
-
94
-        $data = new Data\Collection($response->items[0]);
95
-
96
-        $userProfile = new User\Profile();
97
-
98
-        $userProfile->identifier = strval($data->get('user_id'));
99
-        $userProfile->displayName = $data->get('display_name');
100
-        $userProfile->photoURL = $data->get('profile_image');
101
-        $userProfile->profileURL = $data->get('link');
102
-        $userProfile->region = $data->get('location');
103
-        $userProfile->age = $data->get('age');
104
-
105
-        return $userProfile;
106
-    }
41
+	/**
42
+	 * {@inheritdoc}
43
+	 */
44
+	protected $scope = null;
45
+
46
+	/**
47
+	 * {@inheritdoc}
48
+	 */
49
+	protected $apiBaseUrl = 'https://api.stackexchange.com/2.2/';
50
+
51
+	/**
52
+	 * {@inheritdoc}
53
+	 */
54
+	protected $authorizeUrl = 'https://stackexchange.com/oauth';
55
+
56
+	/**
57
+	 * {@inheritdoc}
58
+	 */
59
+	protected $accessTokenUrl = 'https://stackexchange.com/oauth/access_token';
60
+
61
+	/**
62
+	 * {@inheritdoc}
63
+	 */
64
+	protected $apiDocumentation = 'https://api.stackexchange.com/docs/authentication';
65
+
66
+	/**
67
+	 * {@inheritdoc}
68
+	 */
69
+	protected function initialize()
70
+	{
71
+		parent::initialize();
72
+
73
+		$apiKey = $this->config->get('api_key');
74
+
75
+		$this->apiRequestParameters = ['key' => $apiKey];
76
+	}
77
+
78
+	/**
79
+	 * {@inheritdoc}
80
+	 */
81
+	public function getUserProfile()
82
+	{
83
+		$site = $this->config->get('site');
84
+
85
+		$response = $this->apiRequest('me', 'GET', [
86
+			'site' => $site,
87
+			'access_token' => $this->getStoredData('access_token'),
88
+		]);
89
+
90
+		if (!$response || !isset($response->items) || !isset($response->items[0])) {
91
+			throw new UnexpectedApiResponseException('Provider API returned an unexpected response.');
92
+		}
93
+
94
+		$data = new Data\Collection($response->items[0]);
95
+
96
+		$userProfile = new User\Profile();
97
+
98
+		$userProfile->identifier = strval($data->get('user_id'));
99
+		$userProfile->displayName = $data->get('display_name');
100
+		$userProfile->photoURL = $data->get('profile_image');
101
+		$userProfile->profileURL = $data->get('link');
102
+		$userProfile->region = $data->get('location');
103
+		$userProfile->age = $data->get('age');
104
+
105
+		return $userProfile;
106
+	}
107 107
 }
Please login to merge, or discard this patch.
src/Provider/Blizzard.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -17,49 +17,49 @@
 block discarded – undo
17 17
  */
18 18
 class Blizzard extends OAuth2
19 19
 {
20
-    /**
21
-     * {@inheritdoc}
22
-     */
23
-    protected $scope = '';
20
+	/**
21
+	 * {@inheritdoc}
22
+	 */
23
+	protected $scope = '';
24 24
 
25
-    /**
26
-     * {@inheritdoc}
27
-     */
28
-    protected $apiBaseUrl = 'https://us.battle.net/';
25
+	/**
26
+	 * {@inheritdoc}
27
+	 */
28
+	protected $apiBaseUrl = 'https://us.battle.net/';
29 29
 
30
-    /**
31
-     * {@inheritdoc}
32
-     */
33
-    protected $authorizeUrl = 'https://us.battle.net/oauth/authorize';
30
+	/**
31
+	 * {@inheritdoc}
32
+	 */
33
+	protected $authorizeUrl = 'https://us.battle.net/oauth/authorize';
34 34
 
35
-    /**
36
-     * {@inheritdoc}
37
-     */
38
-    protected $accessTokenUrl = 'https://us.battle.net/oauth/token';
35
+	/**
36
+	 * {@inheritdoc}
37
+	 */
38
+	protected $accessTokenUrl = 'https://us.battle.net/oauth/token';
39 39
 
40
-    /**
41
-     * {@inheritdoc}
42
-     */
43
-    protected $apiDocumentation = 'https://develop.battle.net/documentation';
40
+	/**
41
+	 * {@inheritdoc}
42
+	 */
43
+	protected $apiDocumentation = 'https://develop.battle.net/documentation';
44 44
 
45
-    /**
46
-     * {@inheritdoc}
47
-     */
48
-    public function getUserProfile()
49
-    {
50
-        $response = $this->apiRequest('oauth/userinfo');
45
+	/**
46
+	 * {@inheritdoc}
47
+	 */
48
+	public function getUserProfile()
49
+	{
50
+		$response = $this->apiRequest('oauth/userinfo');
51 51
 
52
-        $data = new Data\Collection($response);
52
+		$data = new Data\Collection($response);
53 53
 
54
-        if (!$data->exists('id')) {
55
-            throw new UnexpectedApiResponseException('Provider API returned an unexpected response.');
56
-        }
54
+		if (!$data->exists('id')) {
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->get('id');
61
-        $userProfile->displayName = $data->get('battletag') ?: $data->get('login');
60
+		$userProfile->identifier = $data->get('id');
61
+		$userProfile->displayName = $data->get('battletag') ?: $data->get('login');
62 62
 
63
-        return $userProfile;
64
-    }
63
+		return $userProfile;
64
+	}
65 65
 }
Please login to merge, or discard this patch.
src/Provider/Dropbox.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -17,58 +17,58 @@
 block discarded – undo
17 17
  */
18 18
 class Dropbox extends OAuth2
19 19
 {
20
-    /**
21
-     * {@inheritdoc}
22
-     */
23
-    protected $scope = 'account_info.read';
20
+	/**
21
+	 * {@inheritdoc}
22
+	 */
23
+	protected $scope = 'account_info.read';
24 24
 
25
-    /**
26
-     * {@inheritdoc}
27
-     */
28
-    protected $apiBaseUrl = 'https://api.dropbox.com/2/';
25
+	/**
26
+	 * {@inheritdoc}
27
+	 */
28
+	protected $apiBaseUrl = 'https://api.dropbox.com/2/';
29 29
 
30
-    /**
31
-     * {@inheritdoc}
32
-     */
33
-    protected $authorizeUrl = 'https://www.dropbox.com/1/oauth2/authorize';
30
+	/**
31
+	 * {@inheritdoc}
32
+	 */
33
+	protected $authorizeUrl = 'https://www.dropbox.com/1/oauth2/authorize';
34 34
 
35
-    /**
36
-     * {@inheritdoc}
37
-     */
38
-    protected $accessTokenUrl = 'https://api.dropbox.com/1/oauth2/token';
35
+	/**
36
+	 * {@inheritdoc}
37
+	 */
38
+	protected $accessTokenUrl = 'https://api.dropbox.com/1/oauth2/token';
39 39
 
40
-    /**
41
-     * {@inheritdoc}
42
-     */
43
-    protected $apiDocumentation = 'https://www.dropbox.com/developers/documentation/http/documentation';
40
+	/**
41
+	 * {@inheritdoc}
42
+	 */
43
+	protected $apiDocumentation = 'https://www.dropbox.com/developers/documentation/http/documentation';
44 44
 
45
-    /**
46
-     * {@inheritdoc}
47
-     */
48
-    public function getUserProfile()
49
-    {
50
-        $response = $this->apiRequest('users/get_current_account', 'POST', [], [], true);
45
+	/**
46
+	 * {@inheritdoc}
47
+	 */
48
+	public function getUserProfile()
49
+	{
50
+		$response = $this->apiRequest('users/get_current_account', 'POST', [], [], true);
51 51
 
52
-        $data = new Data\Collection($response);
52
+		$data = new Data\Collection($response);
53 53
 
54
-        if (!$data->exists('account_id') || !$data->get('account_id')) {
55
-            throw new UnexpectedApiResponseException('Provider API returned an unexpected response.');
56
-        }
54
+		if (!$data->exists('account_id') || !$data->get('account_id')) {
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->get('account_id');
61
-        $userProfile->displayName = $data->filter('name')->get('display_name');
62
-        $userProfile->firstName = $data->filter('name')->get('given_name');
63
-        $userProfile->lastName = $data->filter('name')->get('surname');
64
-        $userProfile->email = $data->get('email');
65
-        $userProfile->photoURL = $data->get('profile_photo_url');
66
-        $userProfile->language = $data->get('locale');
67
-        $userProfile->country = $data->get('country');
68
-        if ($data->get('email_verified')) {
69
-            $userProfile->emailVerified = $data->get('email');
70
-        }
60
+		$userProfile->identifier = $data->get('account_id');
61
+		$userProfile->displayName = $data->filter('name')->get('display_name');
62
+		$userProfile->firstName = $data->filter('name')->get('given_name');
63
+		$userProfile->lastName = $data->filter('name')->get('surname');
64
+		$userProfile->email = $data->get('email');
65
+		$userProfile->photoURL = $data->get('profile_photo_url');
66
+		$userProfile->language = $data->get('locale');
67
+		$userProfile->country = $data->get('country');
68
+		if ($data->get('email_verified')) {
69
+			$userProfile->emailVerified = $data->get('email');
70
+		}
71 71
 
72
-        return $userProfile;
73
-    }
72
+		return $userProfile;
73
+	}
74 74
 }
Please login to merge, or discard this patch.
src/Provider/Tumblr.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -17,81 +17,81 @@
 block discarded – undo
17 17
  */
18 18
 class Tumblr extends OAuth1
19 19
 {
20
-    /**
21
-     * {@inheritdoc}
22
-     */
23
-    protected $apiBaseUrl = 'https://api.tumblr.com/v2/';
24
-
25
-    /**
26
-     * {@inheritdoc}
27
-     */
28
-    protected $authorizeUrl = 'https://www.tumblr.com/oauth/authorize';
29
-
30
-    /**
31
-     * {@inheritdoc}
32
-     */
33
-    protected $requestTokenUrl = 'https://www.tumblr.com/oauth/request_token';
34
-
35
-    /**
36
-     * {@inheritdoc}
37
-     */
38
-    protected $accessTokenUrl = 'https://www.tumblr.com/oauth/access_token';
39
-
40
-    /**
41
-     * {@inheritdoc}
42
-     */
43
-    protected $apiDocumentation = 'https://www.tumblr.com/docs/en/api/v2';
44
-
45
-    /**
46
-     * {@inheritdoc}
47
-     */
48
-    public function getUserProfile()
49
-    {
50
-        $response = $this->apiRequest('user/info');
51
-
52
-        $data = new Data\Collection($response);
53
-
54
-        if (!$data->exists('response')) {
55
-            throw new UnexpectedApiResponseException('Provider API returned an unexpected response.');
56
-        }
57
-
58
-        $userProfile = new User\Profile();
59
-
60
-        $userProfile->displayName = $data->filter('response')->filter('user')->get('name');
61
-
62
-        foreach ($data->filter('response')->filter('user')->filter('blogs')->toArray() as $blog) {
63
-            $blog = new Data\Collection($blog);
64
-
65
-            if ($blog->get('primary') && $blog->exists('url')) {
66
-                $userProfile->identifier = $blog->get('url');
67
-                $userProfile->profileURL = $blog->get('url');
68
-                $userProfile->webSiteURL = $blog->get('url');
69
-                $userProfile->description = strip_tags($blog->get('description'));
70
-
71
-                $bloghostname = explode('://', $blog->get('url'));
72
-                $bloghostname = substr($bloghostname[1], 0, -1);
73
-
74
-                // store user's primary blog which will be used as target by setUserStatus
75
-                $this->storeData('primary_blog', $bloghostname);
76
-
77
-                break;
78
-            }
79
-        }
80
-
81
-        return $userProfile;
82
-    }
83
-
84
-    /**
85
-     * {@inheritdoc}
86
-     */
87
-    public function setUserStatus($status)
88
-    {
89
-        $status = is_string($status)
90
-            ? ['type' => 'text', 'body' => $status]
91
-            : $status;
92
-
93
-        $response = $this->apiRequest('blog/' . $this->getStoredData('primary_blog') . '/post', 'POST', $status);
94
-
95
-        return $response;
96
-    }
20
+	/**
21
+	 * {@inheritdoc}
22
+	 */
23
+	protected $apiBaseUrl = 'https://api.tumblr.com/v2/';
24
+
25
+	/**
26
+	 * {@inheritdoc}
27
+	 */
28
+	protected $authorizeUrl = 'https://www.tumblr.com/oauth/authorize';
29
+
30
+	/**
31
+	 * {@inheritdoc}
32
+	 */
33
+	protected $requestTokenUrl = 'https://www.tumblr.com/oauth/request_token';
34
+
35
+	/**
36
+	 * {@inheritdoc}
37
+	 */
38
+	protected $accessTokenUrl = 'https://www.tumblr.com/oauth/access_token';
39
+
40
+	/**
41
+	 * {@inheritdoc}
42
+	 */
43
+	protected $apiDocumentation = 'https://www.tumblr.com/docs/en/api/v2';
44
+
45
+	/**
46
+	 * {@inheritdoc}
47
+	 */
48
+	public function getUserProfile()
49
+	{
50
+		$response = $this->apiRequest('user/info');
51
+
52
+		$data = new Data\Collection($response);
53
+
54
+		if (!$data->exists('response')) {
55
+			throw new UnexpectedApiResponseException('Provider API returned an unexpected response.');
56
+		}
57
+
58
+		$userProfile = new User\Profile();
59
+
60
+		$userProfile->displayName = $data->filter('response')->filter('user')->get('name');
61
+
62
+		foreach ($data->filter('response')->filter('user')->filter('blogs')->toArray() as $blog) {
63
+			$blog = new Data\Collection($blog);
64
+
65
+			if ($blog->get('primary') && $blog->exists('url')) {
66
+				$userProfile->identifier = $blog->get('url');
67
+				$userProfile->profileURL = $blog->get('url');
68
+				$userProfile->webSiteURL = $blog->get('url');
69
+				$userProfile->description = strip_tags($blog->get('description'));
70
+
71
+				$bloghostname = explode('://', $blog->get('url'));
72
+				$bloghostname = substr($bloghostname[1], 0, -1);
73
+
74
+				// store user's primary blog which will be used as target by setUserStatus
75
+				$this->storeData('primary_blog', $bloghostname);
76
+
77
+				break;
78
+			}
79
+		}
80
+
81
+		return $userProfile;
82
+	}
83
+
84
+	/**
85
+	 * {@inheritdoc}
86
+	 */
87
+	public function setUserStatus($status)
88
+	{
89
+		$status = is_string($status)
90
+			? ['type' => 'text', 'body' => $status]
91
+			: $status;
92
+
93
+		$response = $this->apiRequest('blog/' . $this->getStoredData('primary_blog') . '/post', 'POST', $status);
94
+
95
+		return $response;
96
+	}
97 97
 }
Please login to merge, or discard this patch.
src/autoload.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 if (version_compare(PHP_VERSION, '5.4.0', '<')) {
10
-    throw new Exception('Hybridauth 3 requires PHP version 5.4 or higher.');
10
+	throw new Exception('Hybridauth 3 requires PHP version 5.4 or higher.');
11 11
 }
12 12
 
13 13
 /**
@@ -21,33 +21,33 @@  discard block
 block discarded – undo
21 21
  * @return void
22 22
  */
23 23
 spl_autoload_register(
24
-    function ($class) {
25
-        // project-specific namespace prefix. Will only kicks in for Hybridauth's namespace.
26
-        $prefix = 'Hybridauth\\';
24
+	function ($class) {
25
+		// project-specific namespace prefix. Will only kicks in for Hybridauth's namespace.
26
+		$prefix = 'Hybridauth\\';
27 27
 
28
-        // base directory for the namespace prefix.
29
-        $base_dir = __DIR__;   // By default, it points to this same folder.
30
-        // You may change this path if having trouble detecting the path to
31
-        // the source files.
28
+		// base directory for the namespace prefix.
29
+		$base_dir = __DIR__;   // By default, it points to this same folder.
30
+		// You may change this path if having trouble detecting the path to
31
+		// the source files.
32 32
 
33
-        // does the class use the namespace prefix?
34
-        $len = strlen($prefix);
35
-        if (strncmp($prefix, $class, $len) !== 0) {
36
-            // no, move to the next registered autoloader.
37
-            return;
38
-        }
33
+		// does the class use the namespace prefix?
34
+		$len = strlen($prefix);
35
+		if (strncmp($prefix, $class, $len) !== 0) {
36
+			// no, move to the next registered autoloader.
37
+			return;
38
+		}
39 39
 
40
-        // get the relative class name.
41
-        $relative_class = substr($class, $len);
40
+		// get the relative class name.
41
+		$relative_class = substr($class, $len);
42 42
 
43
-        // replace the namespace prefix with the base directory, replace namespace
44
-        // separators with directory separators in the relative class name, append
45
-        // with .php
46
-        $file = $base_dir . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $relative_class) . '.php';
43
+		// replace the namespace prefix with the base directory, replace namespace
44
+		// separators with directory separators in the relative class name, append
45
+		// with .php
46
+		$file = $base_dir . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $relative_class) . '.php';
47 47
 
48
-        // if the file exists, require it
49
-        if (file_exists($file)) {
50
-            require $file;
51
-        }
52
-    }
48
+		// if the file exists, require it
49
+		if (file_exists($file)) {
50
+			require $file;
51
+		}
52
+	}
53 53
 );
Please login to merge, or discard this patch.
src/Storage/StorageInterface.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -12,39 +12,39 @@
 block discarded – undo
12 12
  */
13 13
 interface StorageInterface
14 14
 {
15
-    /**
16
-     * Retrieve a item from storage
17
-     *
18
-     * @param string $key
19
-     *
20
-     * @return mixed
21
-     */
22
-    public function get($key);
15
+	/**
16
+	 * Retrieve a item from storage
17
+	 *
18
+	 * @param string $key
19
+	 *
20
+	 * @return mixed
21
+	 */
22
+	public function get($key);
23 23
 
24
-    /**
25
-     * Add or Update an item to storage
26
-     *
27
-     * @param string $key
28
-     * @param string $value
29
-     */
30
-    public function set($key, $value);
24
+	/**
25
+	 * Add or Update an item to storage
26
+	 *
27
+	 * @param string $key
28
+	 * @param string $value
29
+	 */
30
+	public function set($key, $value);
31 31
 
32
-    /**
33
-     * Delete an item from storage
34
-     *
35
-     * @param string $key
36
-     */
37
-    public function delete($key);
32
+	/**
33
+	 * Delete an item from storage
34
+	 *
35
+	 * @param string $key
36
+	 */
37
+	public function delete($key);
38 38
 
39
-    /**
40
-     * Delete a item from storage
41
-     *
42
-     * @param string $key
43
-     */
44
-    public function deleteMatch($key);
39
+	/**
40
+	 * Delete a item from storage
41
+	 *
42
+	 * @param string $key
43
+	 */
44
+	public function deleteMatch($key);
45 45
 
46
-    /**
47
-     * Clear all items in storage
48
-     */
49
-    public function clear();
46
+	/**
47
+	 * Clear all items in storage
48
+	 */
49
+	public function clear();
50 50
 }
Please login to merge, or discard this patch.