@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | $this->consumerKey = $this->config->filter('keys')->get('id') ?: $this->config->filter('keys')->get('key'); |
151 | 151 | $this->consumerSecret = $this->config->filter('keys')->get('secret'); |
152 | 152 | |
153 | - if (!$this->consumerKey || !$this->consumerSecret) { |
|
153 | + if ( ! $this->consumerKey || ! $this->consumerSecret) { |
|
154 | 154 | throw new InvalidApplicationCredentialsException( |
155 | - 'Your application id is required in order to connect to ' . $this->providerId |
|
155 | + 'Your application id is required in order to connect to '.$this->providerId |
|
156 | 156 | ); |
157 | 157 | } |
158 | 158 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | try { |
218 | - if (!$this->getStoredData('request_token')) { |
|
218 | + if ( ! $this->getStoredData('request_token')) { |
|
219 | 219 | // Start a new flow. |
220 | 220 | $this->authenticateBegin(); |
221 | 221 | } elseif (empty($_GET['oauth_token']) && empty($_GET['denied'])) { |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function isConnected() |
241 | 241 | { |
242 | - return (bool)$this->getStoredData('access_token'); |
|
242 | + return (bool) $this->getStoredData('access_token'); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -285,17 +285,17 @@ discard block |
||
285 | 285 | |
286 | 286 | if ($denied) { |
287 | 287 | throw new AuthorizationDeniedException( |
288 | - 'User denied access request. Provider returned a denied token: ' . htmlentities($denied) |
|
288 | + 'User denied access request. Provider returned a denied token: '.htmlentities($denied) |
|
289 | 289 | ); |
290 | 290 | } |
291 | 291 | |
292 | 292 | if ($oauth_problem) { |
293 | 293 | throw new InvalidOauthTokenException( |
294 | - 'Provider returned an error. oauth_problem: ' . htmlentities($oauth_problem) |
|
294 | + 'Provider returned an error. oauth_problem: '.htmlentities($oauth_problem) |
|
295 | 295 | ); |
296 | 296 | } |
297 | 297 | |
298 | - if (!$oauth_token) { |
|
298 | + if ( ! $oauth_token) { |
|
299 | 299 | throw new InvalidOauthTokenException( |
300 | 300 | 'Expecting a non-null oauth_token to continue the authorization flow.' |
301 | 301 | ); |
@@ -317,16 +317,16 @@ discard block |
||
317 | 317 | */ |
318 | 318 | protected function getAuthorizeUrl($parameters = []) |
319 | 319 | { |
320 | - $this->AuthorizeUrlParameters = !empty($parameters) |
|
320 | + $this->AuthorizeUrlParameters = ! empty($parameters) |
|
321 | 321 | ? $parameters |
322 | 322 | : array_replace( |
323 | - (array)$this->AuthorizeUrlParameters, |
|
324 | - (array)$this->config->get('authorize_url_parameters') |
|
323 | + (array) $this->AuthorizeUrlParameters, |
|
324 | + (array) $this->config->get('authorize_url_parameters') |
|
325 | 325 | ); |
326 | 326 | |
327 | 327 | $this->AuthorizeUrlParameters['oauth_token'] = $this->getStoredData('request_token'); |
328 | 328 | |
329 | - return $this->authorizeUrl . '?' . http_build_query($this->AuthorizeUrlParameters, '', '&'); |
|
329 | + return $this->authorizeUrl.'?'.http_build_query($this->AuthorizeUrlParameters, '', '&'); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | /** |
@@ -408,9 +408,9 @@ discard block |
||
408 | 408 | |
409 | 409 | $collection = new Data\Collection($tokens); |
410 | 410 | |
411 | - if (!$collection->exists('oauth_token')) { |
|
411 | + if ( ! $collection->exists('oauth_token')) { |
|
412 | 412 | throw new InvalidOauthTokenException( |
413 | - 'Provider returned no oauth_token: ' . htmlentities($response) |
|
413 | + 'Provider returned no oauth_token: '.htmlentities($response) |
|
414 | 414 | ); |
415 | 415 | } |
416 | 416 | |
@@ -506,9 +506,9 @@ discard block |
||
506 | 506 | |
507 | 507 | $collection = new Data\Collection($tokens); |
508 | 508 | |
509 | - if (!$collection->exists('oauth_token')) { |
|
509 | + if ( ! $collection->exists('oauth_token')) { |
|
510 | 510 | throw new InvalidAccessTokenException( |
511 | - 'Provider returned no access_token: ' . htmlentities($response) |
|
511 | + 'Provider returned no access_token: '.htmlentities($response) |
|
512 | 512 | ); |
513 | 513 | } |
514 | 514 | |
@@ -548,12 +548,12 @@ discard block |
||
548 | 548 | $this->maintainToken(); |
549 | 549 | |
550 | 550 | if (strrpos($url, 'http://') !== 0 && strrpos($url, 'https://') !== 0) { |
551 | - $url = rtrim($this->apiBaseUrl, '/') . '/' . ltrim($url, '/'); |
|
551 | + $url = rtrim($this->apiBaseUrl, '/').'/'.ltrim($url, '/'); |
|
552 | 552 | } |
553 | 553 | |
554 | - $parameters = array_replace($this->apiRequestParameters, (array)$parameters); |
|
554 | + $parameters = array_replace($this->apiRequestParameters, (array) $parameters); |
|
555 | 555 | |
556 | - $headers = array_replace($this->apiRequestHeaders, (array)$headers); |
|
556 | + $headers = array_replace($this->apiRequestHeaders, (array) $headers); |
|
557 | 557 | |
558 | 558 | $response = $this->oauthRequest($url, $method, $parameters, $headers, $multipart); |
559 | 559 | |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | ); |
600 | 600 | |
601 | 601 | $uri = $request->get_normalized_http_url(); |
602 | - $headers = array_replace($request->to_header(), (array)$headers); |
|
602 | + $headers = array_replace($request->to_header(), (array) $headers); |
|
603 | 603 | |
604 | 604 | $response = $this->httpClient->request( |
605 | 605 | $uri, |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | $multipart |
610 | 610 | ); |
611 | 611 | |
612 | - $this->validateApiResponse('Signed API request to ' . $uri . ' has returned an error'); |
|
612 | + $this->validateApiResponse('Signed API request to '.$uri.' has returned an error'); |
|
613 | 613 | |
614 | 614 | return $response; |
615 | 615 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | ]); |
69 | 69 | |
70 | 70 | $collection = new Collection($response); |
71 | - if (!$collection->exists('data')) { |
|
71 | + if ( ! $collection->exists('data')) { |
|
72 | 72 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
73 | 73 | } |
74 | 74 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $response = $this->apiRequest($campaignsUrl); |
106 | 106 | $data = new Collection($response); |
107 | 107 | |
108 | - if (!$data->exists('data')) { |
|
108 | + if ( ! $data->exists('data')) { |
|
109 | 109 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
110 | 110 | } |
111 | 111 | |
@@ -134,14 +134,14 @@ discard block |
||
134 | 134 | 'fields[member]' => 'full_name,patron_status,email', |
135 | 135 | 'fields[tier]' => 'title', |
136 | 136 | ]; |
137 | - $membersUrl = 'oauth2/v2/campaigns/' . $campaignId . '/members?' . http_build_query($params); |
|
137 | + $membersUrl = 'oauth2/v2/campaigns/'.$campaignId.'/members?'.http_build_query($params); |
|
138 | 138 | |
139 | 139 | do { |
140 | 140 | $response = $this->apiRequest($membersUrl); |
141 | 141 | |
142 | 142 | $data = new Collection($response); |
143 | 143 | |
144 | - if (!$data->exists('data')) { |
|
144 | + if ( ! $data->exists('data')) { |
|
145 | 145 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
146 | 146 | } |
147 | 147 |
@@ -82,7 +82,7 @@ |
||
82 | 82 | |
83 | 83 | $userProfile->identifier = $collection->get('userId'); |
84 | 84 | $userProfile->displayName |
85 | - = $collection->get('firstName') .' '. $collection->get('lastName'); |
|
85 | + = $collection->get('firstName').' '.$collection->get('lastName'); |
|
86 | 86 | $userProfile->firstName = $collection->get('firstName'); |
87 | 87 | $userProfile->lastName = $collection->get('lastName'); |
88 | 88 | $userProfile->email = $collection->get('emailId'); |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | ]; |
56 | 56 | |
57 | 57 | |
58 | - $response = $this->apiRequest('me', 'GET', ['projection' => '(' . implode(',', $fields) . ')']); |
|
58 | + $response = $this->apiRequest('me', 'GET', ['projection' => '('.implode(',', $fields).')']); |
|
59 | 59 | $data = new Data\Collection($response); |
60 | 60 | |
61 | - if (!$data->exists('id')) { |
|
61 | + if ( ! $data->exists('id')) { |
|
62 | 62 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
63 | 63 | } |
64 | 64 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $userProfile->identifier = $data->get('id'); |
79 | 79 | $userProfile->email = $this->getUserEmail(); |
80 | 80 | $userProfile->emailVerified = $userProfile->email; |
81 | - $userProfile->displayName = trim($userProfile->firstName . ' ' . $userProfile->lastName); |
|
81 | + $userProfile->displayName = trim($userProfile->firstName.' '.$userProfile->lastName); |
|
82 | 82 | |
83 | 83 | $photo_elements = $data |
84 | 84 | ->filter('profilePicture') |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | if (is_array($elements)) { |
106 | 106 | // Get the largest picture from the list which is the last one. |
107 | 107 | $element = end($elements); |
108 | - if (!empty($element->identifiers)) { |
|
108 | + if ( ! empty($element->identifiers)) { |
|
109 | 109 | return reset($element->identifiers)->identifier; |
110 | 110 | } |
111 | 111 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | if (is_string($status)) { |
156 | 156 | $status = [ |
157 | - 'author' => 'urn:li:person:' . $userID, |
|
157 | + 'author' => 'urn:li:person:'.$userID, |
|
158 | 158 | 'lifecycleState' => 'PUBLISHED', |
159 | 159 | 'specificContent' => [ |
160 | 160 | 'com.linkedin.ugc.ShareContent' => [ |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | { |
198 | 198 | $locale = $data->filter($field_name)->filter('preferredLocale'); |
199 | 199 | if ($locale) { |
200 | - return $locale->get('language') . '_' . $locale->get('country'); |
|
200 | + return $locale->get('language').'_'.$locale->get('country'); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | return 'en_US'; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | $data = new Data\Collection($response); |
90 | 90 | |
91 | - if (!$data->exists('id_str')) { |
|
91 | + if ( ! $data->exists('id_str')) { |
|
92 | 92 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
93 | 93 | } |
94 | 94 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $userProfile->region = $data->get('location'); |
105 | 105 | |
106 | 106 | $userProfile->profileURL = $data->exists('screen_name') |
107 | - ? ('https://twitter.com/' . $data->get('screen_name')) |
|
107 | + ? ('https://twitter.com/'.$data->get('screen_name')) |
|
108 | 108 | : ''; |
109 | 109 | |
110 | 110 | $photoSize = $this->config->get('photo_size') ?: 'original'; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | $data = new Data\Collection($response); |
134 | 134 | |
135 | - if (!$data->exists('ids')) { |
|
135 | + if ( ! $data->exists('ids')) { |
|
136 | 136 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
137 | 137 | } |
138 | 138 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $contacts = []; |
144 | 144 | |
145 | 145 | // 75 id per time should be okey |
146 | - $contactsIds = array_chunk((array)$data->get('ids'), 75); |
|
146 | + $contactsIds = array_chunk((array) $data->get('ids'), 75); |
|
147 | 147 | |
148 | 148 | foreach ($contactsIds as $chunk) { |
149 | 149 | $parameters = ['user_id' => implode(',', $chunk)]; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $userContact->description = $item->get('description'); |
182 | 182 | |
183 | 183 | $userContact->profileURL = $item->exists('screen_name') |
184 | - ? ('https://twitter.com/' . $item->get('screen_name')) |
|
184 | + ? ('https://twitter.com/'.$item->get('screen_name')) |
|
185 | 185 | : ''; |
186 | 186 | |
187 | 187 | return $userContact; |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | $response = $this->apiRequest($apiUrl); |
226 | 226 | |
227 | - if (!$response) { |
|
227 | + if ( ! $response) { |
|
228 | 228 | return []; |
229 | 229 | } |
230 | 230 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | $userActivity->user->photoURL = $item->filter('user')->get('profile_image_url'); |
257 | 257 | |
258 | 258 | $userActivity->user->profileURL = $item->filter('user')->get('screen_name') |
259 | - ? ('https://twitter.com/' . $item->filter('user')->get('screen_name')) |
|
259 | + ? ('https://twitter.com/'.$item->filter('user')->get('screen_name')) |
|
260 | 260 | : ''; |
261 | 261 | |
262 | 262 | return $userActivity; |
@@ -48,24 +48,24 @@ discard block |
||
48 | 48 | { |
49 | 49 | parent::configure(); |
50 | 50 | |
51 | - if (!$this->config->exists('url')) { |
|
51 | + if ( ! $this->config->exists('url')) { |
|
52 | 52 | throw new InvalidApplicationCredentialsException( |
53 | 53 | 'You must define a provider url' |
54 | 54 | ); |
55 | 55 | } |
56 | 56 | $url = $this->config->get('url'); |
57 | 57 | |
58 | - if (!$this->config->exists('realm')) { |
|
58 | + if ( ! $this->config->exists('realm')) { |
|
59 | 59 | throw new InvalidApplicationCredentialsException( |
60 | 60 | 'You must define a realm' |
61 | 61 | ); |
62 | 62 | } |
63 | 63 | $realm = $this->config->get('realm'); |
64 | 64 | |
65 | - $this->apiBaseUrl = $url . '/realms/' . $realm . '/protocol/openid-connect/'; |
|
65 | + $this->apiBaseUrl = $url.'/realms/'.$realm.'/protocol/openid-connect/'; |
|
66 | 66 | |
67 | - $this->authorizeUrl = $this->apiBaseUrl . 'auth'; |
|
68 | - $this->accessTokenUrl = $this->apiBaseUrl . 'token'; |
|
67 | + $this->authorizeUrl = $this->apiBaseUrl.'auth'; |
|
68 | + $this->accessTokenUrl = $this->apiBaseUrl.'token'; |
|
69 | 69 | |
70 | 70 | } |
71 | 71 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $data = new Data\Collection($response); |
80 | 80 | |
81 | - if (!$data->exists('sub')) { |
|
81 | + if ( ! $data->exists('sub')) { |
|
82 | 82 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
83 | 83 | } |
84 | 84 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct($data = null) |
26 | 26 | { |
27 | - $this->collection = (object)$data; |
|
27 | + $this->collection = (object) $data; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function toArray() |
36 | 36 | { |
37 | - return (array)$this->collection; |
|
37 | + return (array) $this->collection; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | if ($this->exists($property)) { |
79 | 79 | $data = $this->get($property); |
80 | 80 | |
81 | - if (!is_a($data, 'Collection')) { |
|
81 | + if ( ! is_a($data, 'Collection')) { |
|
82 | 82 | $data = new Collection($data); |
83 | 83 | } |
84 | 84 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function isEmpty() |
109 | 109 | { |
110 | - return !(bool)$this->count(); |
|
110 | + return ! (bool) $this->count(); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -51,7 +51,7 @@ discard block |
||
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 | |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | { |
85 | 85 | $result = (new Data\Parser())->parseBirthday($birthday); |
86 | 86 | |
87 | - $userProfile->birthDay = (int)$result[0]; |
|
88 | - $userProfile->birthMonth = (int)$result[1]; |
|
89 | - $userProfile->birthYear = (int)$result[2]; |
|
87 | + $userProfile->birthDay = (int) $result[0]; |
|
88 | + $userProfile->birthMonth = (int) $result[1]; |
|
89 | + $userProfile->birthYear = (int) $result[2]; |
|
90 | 90 | |
91 | 91 | return $userProfile; |
92 | 92 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | |
47 | 47 | $data = new Data\Collection($response); |
48 | 48 | |
49 | - if (!$data->exists('oauth_user_id')) { |
|
49 | + if ( ! $data->exists('oauth_user_id')) { |
|
50 | 50 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
51 | 51 | } |
52 | 52 |