@@ -17,56 +17,56 @@ |
||
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 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | |
52 | 52 | $data = new Data\Collection($response); |
53 | 53 | |
54 | - if (!$data->exists('id')) { |
|
54 | + if ( ! $data->exists('id')) { |
|
55 | 55 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
56 | 56 | } |
57 | 57 |
@@ -17,124 +17,124 @@ |
||
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 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | $data = new Data\Collection($response); |
68 | 68 | |
69 | - if (!$data->exists('response')) { |
|
69 | + if ( ! $data->exists('response')) { |
|
70 | 70 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
71 | 71 | } |
72 | 72 | |
@@ -81,14 +81,14 @@ discard block |
||
81 | 81 | $userProfile->city = $data->get('homeCity'); |
82 | 82 | $userProfile->email = $data->filter('contact')->get('email'); |
83 | 83 | $userProfile->emailVerified = $userProfile->email; |
84 | - $userProfile->profileURL = 'https://www.foursquare.com/user/' . $userProfile->identifier; |
|
85 | - $userProfile->displayName = trim($userProfile->firstName . ' ' . $userProfile->lastName); |
|
84 | + $userProfile->profileURL = 'https://www.foursquare.com/user/'.$userProfile->identifier; |
|
85 | + $userProfile->displayName = trim($userProfile->firstName.' '.$userProfile->lastName); |
|
86 | 86 | |
87 | 87 | if ($data->exists('photo')) { |
88 | 88 | $photoSize = $this->config->get('photo_size') ?: '150x150'; |
89 | 89 | |
90 | 90 | $userProfile->photoURL = $data->filter('photo')->get('prefix'); |
91 | - $userProfile->photoURL .= $photoSize . $data->filter('photo')->get('suffix'); |
|
91 | + $userProfile->photoURL .= $photoSize.$data->filter('photo')->get('suffix'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | return $userProfile; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | $data = new Data\Collection($response); |
105 | 105 | |
106 | - if (!$data->exists('response')) { |
|
106 | + if ( ! $data->exists('response')) { |
|
107 | 107 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
108 | 108 | } |
109 | 109 | |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | |
132 | 132 | $userContact->identifier = $item->get('id'); |
133 | 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')); |
|
134 | + $userContact->photoURL .= $photoSize.$item->filter('photo')->get('suffix'); |
|
135 | + $userContact->displayName = trim($item->get('firstName').' '.$item->get('lastName')); |
|
136 | 136 | $userContact->email = $item->filter('contact')->get('email'); |
137 | 137 | |
138 | 138 | return $userContact; |
@@ -14,29 +14,29 @@ |
||
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 | } |
@@ -31,12 +31,12 @@ |
||
31 | 31 | { |
32 | 32 | parent::authenticateFinish(); |
33 | 33 | |
34 | - $userProfile = $this->storage->get($this->providerId . '.user'); |
|
34 | + $userProfile = $this->storage->get($this->providerId.'.user'); |
|
35 | 35 | |
36 | - $userProfile->identifier = !empty($userProfile->identifier) ? $userProfile->identifier : $userProfile->email; |
|
36 | + $userProfile->identifier = ! empty($userProfile->identifier) ? $userProfile->identifier : $userProfile->email; |
|
37 | 37 | $userProfile->emailVerified = $userProfile->email; |
38 | 38 | |
39 | 39 | // re store the user profile |
40 | - $this->storage->set($this->providerId . '.user', $userProfile); |
|
40 | + $this->storage->set($this->providerId.'.user', $userProfile); |
|
41 | 41 | } |
42 | 42 | } |
@@ -38,70 +38,70 @@ |
||
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 | } |
@@ -87,7 +87,7 @@ |
||
87 | 87 | 'access_token' => $this->getStoredData('access_token'), |
88 | 88 | ]); |
89 | 89 | |
90 | - if (!$response || !isset($response->items) || !isset($response->items[0])) { |
|
90 | + if ( ! $response || ! isset($response->items) || ! isset($response->items[0])) { |
|
91 | 91 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
92 | 92 | } |
93 | 93 |
@@ -17,81 +17,81 @@ |
||
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 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | $data = new Data\Collection($response); |
53 | 53 | |
54 | - if (!$data->exists('response')) { |
|
54 | + if ( ! $data->exists('response')) { |
|
55 | 55 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
56 | 56 | } |
57 | 57 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | ? ['type' => 'text', 'body' => $status] |
91 | 91 | : $status; |
92 | 92 | |
93 | - $response = $this->apiRequest('blog/' . $this->getStoredData('primary_blog') . '/post', 'POST', $status); |
|
93 | + $response = $this->apiRequest('blog/'.$this->getStoredData('primary_blog').'/post', 'POST', $status); |
|
94 | 94 | |
95 | 95 | return $response; |
96 | 96 | } |
@@ -7,7 +7,7 @@ discard block |
||
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 |
||
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 | ); |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * @return void |
22 | 22 | */ |
23 | 23 | spl_autoload_register( |
24 | - function ($class) { |
|
24 | + function($class) { |
|
25 | 25 | // project-specific namespace prefix. Will only kicks in for Hybridauth's namespace. |
26 | 26 | $prefix = 'Hybridauth\\'; |
27 | 27 | |
28 | 28 | // base directory for the namespace prefix. |
29 | - $base_dir = __DIR__; // By default, it points to this same folder. |
|
29 | + $base_dir = __DIR__; // By default, it points to this same folder. |
|
30 | 30 | // You may change this path if having trouble detecting the path to |
31 | 31 | // the source files. |
32 | 32 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | // replace the namespace prefix with the base directory, replace namespace |
44 | 44 | // separators with directory separators in the relative class name, append |
45 | 45 | // with .php |
46 | - $file = $base_dir . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $relative_class) . '.php'; |
|
46 | + $file = $base_dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $relative_class).'.php'; |
|
47 | 47 | |
48 | 48 | // if the file exists, require it |
49 | 49 | if (file_exists($file)) { |
@@ -12,39 +12,39 @@ |
||
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 | } |
@@ -14,177 +14,177 @@ |
||
14 | 14 | */ |
15 | 15 | final class Profile |
16 | 16 | { |
17 | - /** |
|
18 | - * The Unique user's ID on the connected provider |
|
19 | - * |
|
20 | - * @var int|null |
|
21 | - */ |
|
22 | - public $identifier = null; |
|
23 | - |
|
24 | - /** |
|
25 | - * User website, blog, web page |
|
26 | - * |
|
27 | - * @var string|null |
|
28 | - */ |
|
29 | - public $webSiteURL = null; |
|
30 | - |
|
31 | - /** |
|
32 | - * URL link to profile page on the IDp web site |
|
33 | - * |
|
34 | - * @var string|null |
|
35 | - */ |
|
36 | - public $profileURL = null; |
|
37 | - |
|
38 | - /** |
|
39 | - * URL link to user photo or avatar |
|
40 | - * |
|
41 | - * @var string|null |
|
42 | - */ |
|
43 | - public $photoURL = null; |
|
44 | - |
|
45 | - /** |
|
46 | - * User displayName provided by the IDp or a concatenation of first and last name. |
|
47 | - * |
|
48 | - * @var string|null |
|
49 | - */ |
|
50 | - public $displayName = null; |
|
51 | - |
|
52 | - /** |
|
53 | - * A short about_me |
|
54 | - * |
|
55 | - * @var string|null |
|
56 | - */ |
|
57 | - public $description = null; |
|
58 | - |
|
59 | - /** |
|
60 | - * User's first name |
|
61 | - * |
|
62 | - * @var string|null |
|
63 | - */ |
|
64 | - public $firstName = null; |
|
65 | - |
|
66 | - /** |
|
67 | - * User's last name |
|
68 | - * |
|
69 | - * @var string|null |
|
70 | - */ |
|
71 | - public $lastName = null; |
|
72 | - |
|
73 | - /** |
|
74 | - * male or female |
|
75 | - * |
|
76 | - * @var string|null |
|
77 | - */ |
|
78 | - public $gender = null; |
|
79 | - |
|
80 | - /** |
|
81 | - * Language |
|
82 | - * |
|
83 | - * @var string|null |
|
84 | - */ |
|
85 | - public $language = null; |
|
86 | - |
|
87 | - /** |
|
88 | - * User age, we don't calculate it. we return it as is if the IDp provide it. |
|
89 | - * |
|
90 | - * @var int|null |
|
91 | - */ |
|
92 | - public $age = null; |
|
93 | - |
|
94 | - /** |
|
95 | - * User birth Day |
|
96 | - * |
|
97 | - * @var int|null |
|
98 | - */ |
|
99 | - public $birthDay = null; |
|
100 | - |
|
101 | - /** |
|
102 | - * User birth Month |
|
103 | - * |
|
104 | - * @var int|null |
|
105 | - */ |
|
106 | - public $birthMonth = null; |
|
107 | - |
|
108 | - /** |
|
109 | - * User birth Year |
|
110 | - * |
|
111 | - * @var int|null |
|
112 | - */ |
|
113 | - public $birthYear = null; |
|
114 | - |
|
115 | - /** |
|
116 | - * User email. Note: not all of IDp grant access to the user email |
|
117 | - * |
|
118 | - * @var string|null |
|
119 | - */ |
|
120 | - public $email = null; |
|
121 | - |
|
122 | - /** |
|
123 | - * Verified user email. Note: not all of IDp grant access to verified user email |
|
124 | - * |
|
125 | - * @var string|null |
|
126 | - */ |
|
127 | - public $emailVerified = null; |
|
128 | - |
|
129 | - /** |
|
130 | - * Phone number |
|
131 | - * |
|
132 | - * @var string|null |
|
133 | - */ |
|
134 | - public $phone = null; |
|
135 | - |
|
136 | - /** |
|
137 | - * Complete user address |
|
138 | - * |
|
139 | - * @var string|null |
|
140 | - */ |
|
141 | - public $address = null; |
|
142 | - |
|
143 | - /** |
|
144 | - * User country |
|
145 | - * |
|
146 | - * @var string|null |
|
147 | - */ |
|
148 | - public $country = null; |
|
149 | - |
|
150 | - /** |
|
151 | - * Region |
|
152 | - * |
|
153 | - * @var string|null |
|
154 | - */ |
|
155 | - public $region = null; |
|
156 | - |
|
157 | - /** |
|
158 | - * City |
|
159 | - * |
|
160 | - * @var string|null |
|
161 | - */ |
|
162 | - public $city = null; |
|
163 | - |
|
164 | - /** |
|
165 | - * Postal code |
|
166 | - * |
|
167 | - * @var string|null |
|
168 | - */ |
|
169 | - public $zip = null; |
|
170 | - |
|
171 | - /** |
|
172 | - * An extra data which is related to the user |
|
173 | - * |
|
174 | - * @var array |
|
175 | - */ |
|
176 | - public $data = []; |
|
177 | - |
|
178 | - /** |
|
179 | - * Prevent the providers adapters from adding new fields. |
|
180 | - * |
|
181 | - * @throws UnexpectedValueException |
|
182 | - * @var mixed $value |
|
183 | - * |
|
184 | - * @var string $name |
|
185 | - */ |
|
186 | - public function __set($name, $value) |
|
187 | - { |
|
188 | - throw new UnexpectedValueException(sprintf('Adding new property "%s" to %s is not allowed.', $name, __CLASS__)); |
|
189 | - } |
|
17 | + /** |
|
18 | + * The Unique user's ID on the connected provider |
|
19 | + * |
|
20 | + * @var int|null |
|
21 | + */ |
|
22 | + public $identifier = null; |
|
23 | + |
|
24 | + /** |
|
25 | + * User website, blog, web page |
|
26 | + * |
|
27 | + * @var string|null |
|
28 | + */ |
|
29 | + public $webSiteURL = null; |
|
30 | + |
|
31 | + /** |
|
32 | + * URL link to profile page on the IDp web site |
|
33 | + * |
|
34 | + * @var string|null |
|
35 | + */ |
|
36 | + public $profileURL = null; |
|
37 | + |
|
38 | + /** |
|
39 | + * URL link to user photo or avatar |
|
40 | + * |
|
41 | + * @var string|null |
|
42 | + */ |
|
43 | + public $photoURL = null; |
|
44 | + |
|
45 | + /** |
|
46 | + * User displayName provided by the IDp or a concatenation of first and last name. |
|
47 | + * |
|
48 | + * @var string|null |
|
49 | + */ |
|
50 | + public $displayName = null; |
|
51 | + |
|
52 | + /** |
|
53 | + * A short about_me |
|
54 | + * |
|
55 | + * @var string|null |
|
56 | + */ |
|
57 | + public $description = null; |
|
58 | + |
|
59 | + /** |
|
60 | + * User's first name |
|
61 | + * |
|
62 | + * @var string|null |
|
63 | + */ |
|
64 | + public $firstName = null; |
|
65 | + |
|
66 | + /** |
|
67 | + * User's last name |
|
68 | + * |
|
69 | + * @var string|null |
|
70 | + */ |
|
71 | + public $lastName = null; |
|
72 | + |
|
73 | + /** |
|
74 | + * male or female |
|
75 | + * |
|
76 | + * @var string|null |
|
77 | + */ |
|
78 | + public $gender = null; |
|
79 | + |
|
80 | + /** |
|
81 | + * Language |
|
82 | + * |
|
83 | + * @var string|null |
|
84 | + */ |
|
85 | + public $language = null; |
|
86 | + |
|
87 | + /** |
|
88 | + * User age, we don't calculate it. we return it as is if the IDp provide it. |
|
89 | + * |
|
90 | + * @var int|null |
|
91 | + */ |
|
92 | + public $age = null; |
|
93 | + |
|
94 | + /** |
|
95 | + * User birth Day |
|
96 | + * |
|
97 | + * @var int|null |
|
98 | + */ |
|
99 | + public $birthDay = null; |
|
100 | + |
|
101 | + /** |
|
102 | + * User birth Month |
|
103 | + * |
|
104 | + * @var int|null |
|
105 | + */ |
|
106 | + public $birthMonth = null; |
|
107 | + |
|
108 | + /** |
|
109 | + * User birth Year |
|
110 | + * |
|
111 | + * @var int|null |
|
112 | + */ |
|
113 | + public $birthYear = null; |
|
114 | + |
|
115 | + /** |
|
116 | + * User email. Note: not all of IDp grant access to the user email |
|
117 | + * |
|
118 | + * @var string|null |
|
119 | + */ |
|
120 | + public $email = null; |
|
121 | + |
|
122 | + /** |
|
123 | + * Verified user email. Note: not all of IDp grant access to verified user email |
|
124 | + * |
|
125 | + * @var string|null |
|
126 | + */ |
|
127 | + public $emailVerified = null; |
|
128 | + |
|
129 | + /** |
|
130 | + * Phone number |
|
131 | + * |
|
132 | + * @var string|null |
|
133 | + */ |
|
134 | + public $phone = null; |
|
135 | + |
|
136 | + /** |
|
137 | + * Complete user address |
|
138 | + * |
|
139 | + * @var string|null |
|
140 | + */ |
|
141 | + public $address = null; |
|
142 | + |
|
143 | + /** |
|
144 | + * User country |
|
145 | + * |
|
146 | + * @var string|null |
|
147 | + */ |
|
148 | + public $country = null; |
|
149 | + |
|
150 | + /** |
|
151 | + * Region |
|
152 | + * |
|
153 | + * @var string|null |
|
154 | + */ |
|
155 | + public $region = null; |
|
156 | + |
|
157 | + /** |
|
158 | + * City |
|
159 | + * |
|
160 | + * @var string|null |
|
161 | + */ |
|
162 | + public $city = null; |
|
163 | + |
|
164 | + /** |
|
165 | + * Postal code |
|
166 | + * |
|
167 | + * @var string|null |
|
168 | + */ |
|
169 | + public $zip = null; |
|
170 | + |
|
171 | + /** |
|
172 | + * An extra data which is related to the user |
|
173 | + * |
|
174 | + * @var array |
|
175 | + */ |
|
176 | + public $data = []; |
|
177 | + |
|
178 | + /** |
|
179 | + * Prevent the providers adapters from adding new fields. |
|
180 | + * |
|
181 | + * @throws UnexpectedValueException |
|
182 | + * @var mixed $value |
|
183 | + * |
|
184 | + * @var string $name |
|
185 | + */ |
|
186 | + public function __set($name, $value) |
|
187 | + { |
|
188 | + throw new UnexpectedValueException(sprintf('Adding new property "%s" to %s is not allowed.', $name, __CLASS__)); |
|
189 | + } |
|
190 | 190 | } |
@@ -14,60 +14,60 @@ |
||
14 | 14 | */ |
15 | 15 | final class Activity |
16 | 16 | { |
17 | - /** |
|
18 | - * activity id on the provider side, usually given as integer |
|
19 | - * |
|
20 | - * @var string |
|
21 | - */ |
|
22 | - public $id = null; |
|
17 | + /** |
|
18 | + * activity id on the provider side, usually given as integer |
|
19 | + * |
|
20 | + * @var string |
|
21 | + */ |
|
22 | + public $id = null; |
|
23 | 23 | |
24 | - /** |
|
25 | - * activity date of creation |
|
26 | - * |
|
27 | - * @var string |
|
28 | - */ |
|
29 | - public $date = null; |
|
24 | + /** |
|
25 | + * activity date of creation |
|
26 | + * |
|
27 | + * @var string |
|
28 | + */ |
|
29 | + public $date = null; |
|
30 | 30 | |
31 | - /** |
|
32 | - * activity content as a string |
|
33 | - * |
|
34 | - * @var string |
|
35 | - */ |
|
36 | - public $text = null; |
|
31 | + /** |
|
32 | + * activity content as a string |
|
33 | + * |
|
34 | + * @var string |
|
35 | + */ |
|
36 | + public $text = null; |
|
37 | 37 | |
38 | - /** |
|
39 | - * user who created the activity |
|
40 | - * |
|
41 | - * @var object |
|
42 | - */ |
|
43 | - public $user = null; |
|
38 | + /** |
|
39 | + * user who created the activity |
|
40 | + * |
|
41 | + * @var object |
|
42 | + */ |
|
43 | + public $user = null; |
|
44 | 44 | |
45 | - /** |
|
46 | - * |
|
47 | - */ |
|
48 | - public function __construct() |
|
49 | - { |
|
50 | - $this->user = new \stdClass(); |
|
45 | + /** |
|
46 | + * |
|
47 | + */ |
|
48 | + public function __construct() |
|
49 | + { |
|
50 | + $this->user = new \stdClass(); |
|
51 | 51 | |
52 | - // typically, we should have a few information about the user who created the event from social apis |
|
53 | - $this->user->identifier = null; |
|
54 | - $this->user->displayName = null; |
|
55 | - $this->user->profileURL = null; |
|
56 | - $this->user->photoURL = null; |
|
57 | - } |
|
52 | + // typically, we should have a few information about the user who created the event from social apis |
|
53 | + $this->user->identifier = null; |
|
54 | + $this->user->displayName = null; |
|
55 | + $this->user->profileURL = null; |
|
56 | + $this->user->photoURL = null; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * Prevent the providers adapters from adding new fields. |
|
61 | - * |
|
62 | - * @throws UnexpectedValueException |
|
63 | - * @var string $name |
|
64 | - * |
|
65 | - * @var mixed $value |
|
66 | - * |
|
67 | - */ |
|
68 | - public function __set($name, $value) |
|
69 | - { |
|
70 | - // phpcs:ignore |
|
71 | - throw new UnexpectedValueException(sprintf('Adding new property "%s\' to %s is not allowed.', $name, __CLASS__)); |
|
72 | - } |
|
59 | + /** |
|
60 | + * Prevent the providers adapters from adding new fields. |
|
61 | + * |
|
62 | + * @throws UnexpectedValueException |
|
63 | + * @var string $name |
|
64 | + * |
|
65 | + * @var mixed $value |
|
66 | + * |
|
67 | + */ |
|
68 | + public function __set($name, $value) |
|
69 | + { |
|
70 | + // phpcs:ignore |
|
71 | + throw new UnexpectedValueException(sprintf('Adding new property "%s\' to %s is not allowed.', $name, __CLASS__)); |
|
72 | + } |
|
73 | 73 | } |