@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * limitations under the License. |
16 | 16 | */ |
17 | 17 | |
18 | -if (!class_exists('MonsterInsights_GA_Lib_Client')) { |
|
18 | +if ( ! class_exists('MonsterInsights_GA_Lib_Client')) { |
|
19 | 19 | require_once dirname(__FILE__) . '/../autoload.php'; |
20 | 20 | } |
21 | 21 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | if ($token == null) { |
186 | 186 | throw new MonsterInsights_GA_Lib_Auth_Exception('Could not json decode the token'); |
187 | 187 | } |
188 | - if (! isset($token['access_token'])) { |
|
188 | + if ( ! isset($token['access_token'])) { |
|
189 | 189 | throw new MonsterInsights_GA_Lib_Auth_Exception("Invalid token format"); |
190 | 190 | } |
191 | 191 | $this->token = $token; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $this->refreshTokenWithAssertion(); |
241 | 241 | } else { |
242 | 242 | $this->client->getLogger()->debug('OAuth2 access token expired'); |
243 | - if (! array_key_exists('refresh_token', $this->token)) { |
|
243 | + if ( ! array_key_exists('refresh_token', $this->token)) { |
|
244 | 244 | $error = "The OAuth 2.0 access token has expired," |
245 | 245 | ." and a refresh token is not available. Refresh tokens" |
246 | 246 | ." are not returned for responses that were auto-approved."; |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | */ |
287 | 287 | public function refreshTokenWithAssertion($assertionCredentials = null) |
288 | 288 | { |
289 | - if (!$assertionCredentials) { |
|
289 | + if ( ! $assertionCredentials) { |
|
290 | 290 | $assertionCredentials = $this->assertionCredentials; |
291 | 291 | } |
292 | 292 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | if ($token) { |
301 | 301 | $this->setAccessToken($token); |
302 | 302 | } |
303 | - if (!$this->isAccessTokenExpired()) { |
|
303 | + if ( ! $this->isAccessTokenExpired()) { |
|
304 | 304 | return; |
305 | 305 | } |
306 | 306 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | throw new MonsterInsights_GA_Lib_Auth_Exception("Could not json decode the access token"); |
351 | 351 | } |
352 | 352 | |
353 | - if (! isset($token['access_token']) || ! isset($token['expires_in'])) { |
|
353 | + if ( ! isset($token['access_token']) || ! isset($token['expires_in'])) { |
|
354 | 354 | throw new MonsterInsights_GA_Lib_Auth_Exception("Invalid token format"); |
355 | 355 | } |
356 | 356 | |
@@ -374,8 +374,8 @@ discard block |
||
374 | 374 | */ |
375 | 375 | public function revokeToken($token = null) |
376 | 376 | { |
377 | - if (!$token) { |
|
378 | - if (!$this->token) { |
|
377 | + if ( ! $token) { |
|
378 | + if ( ! $this->token) { |
|
379 | 379 | // Not initialized, no token to actually revoke |
380 | 380 | return false; |
381 | 381 | } elseif (array_key_exists('refresh_token', $this->token)) { |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | */ |
408 | 408 | public function isAccessTokenExpired() |
409 | 409 | { |
410 | - if (!$this->token || !isset($this->token['created'])) { |
|
410 | + if ( ! $this->token || ! isset($this->token['created'])) { |
|
411 | 411 | return true; |
412 | 412 | } |
413 | 413 | |
@@ -481,11 +481,11 @@ discard block |
||
481 | 481 | */ |
482 | 482 | public function verifyIdToken($id_token = null, $audience = null) |
483 | 483 | { |
484 | - if (!$id_token) { |
|
484 | + if ( ! $id_token) { |
|
485 | 485 | $id_token = $this->token['id_token']; |
486 | 486 | } |
487 | 487 | $certs = $this->getFederatedSignonCerts(); |
488 | - if (!$audience) { |
|
488 | + if ( ! $audience) { |
|
489 | 489 | $audience = $this->client->getClassConfig($this, 'client_id'); |
490 | 490 | } |
491 | 491 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | $issuer = null, |
516 | 516 | $max_expiry = null |
517 | 517 | ) { |
518 | - if (!$max_expiry) { |
|
518 | + if ( ! $max_expiry) { |
|
519 | 519 | // Set the maximum time we will accept a token for. |
520 | 520 | $max_expiry = self::MAX_TOKEN_LIFETIME_SECS; |
521 | 521 | } |
@@ -529,14 +529,14 @@ discard block |
||
529 | 529 | |
530 | 530 | // Parse envelope. |
531 | 531 | $envelope = json_decode(MonsterInsights_GA_Lib_Utils::urlSafeB64Decode($segments[0]), true); |
532 | - if (!$envelope) { |
|
532 | + if ( ! $envelope) { |
|
533 | 533 | throw new MonsterInsights_GA_Lib_Auth_Exception("Can't parse token envelope: " . $segments[0]); |
534 | 534 | } |
535 | 535 | |
536 | 536 | // Parse token |
537 | 537 | $json_body = MonsterInsights_GA_Lib_Utils::urlSafeB64Decode($segments[1]); |
538 | 538 | $payload = json_decode($json_body, true); |
539 | - if (!$payload) { |
|
539 | + if ( ! $payload) { |
|
540 | 540 | throw new MonsterInsights_GA_Lib_Auth_Exception("Can't parse token payload: " . $segments[1]); |
541 | 541 | } |
542 | 542 | |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | } |
551 | 551 | } |
552 | 552 | |
553 | - if (!$verified) { |
|
553 | + if ( ! $verified) { |
|
554 | 554 | throw new MonsterInsights_GA_Lib_Auth_Exception("Invalid token signature: $jwt"); |
555 | 555 | } |
556 | 556 | |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | if (array_key_exists("iat", $payload)) { |
560 | 560 | $iat = $payload["iat"]; |
561 | 561 | } |
562 | - if (!$iat) { |
|
562 | + if ( ! $iat) { |
|
563 | 563 | throw new MonsterInsights_GA_Lib_Auth_Exception("No issue time in token: $json_body"); |
564 | 564 | } |
565 | 565 | $earliest = $iat - self::CLOCK_SKEW_SECS; |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | if (array_key_exists("exp", $payload)) { |
571 | 571 | $exp = $payload["exp"]; |
572 | 572 | } |
573 | - if (!$exp) { |
|
573 | + if ( ! $exp) { |
|
574 | 574 | throw new MonsterInsights_GA_Lib_Auth_Exception("No expiration time in token: $json_body"); |
575 | 575 | } |
576 | 576 | if ($exp >= $now + $max_expiry) { |
@@ -604,12 +604,12 @@ discard block |
||
604 | 604 | // support HTTP and HTTPS issuers |
605 | 605 | // @see https://developers.google.com/identity/sign-in/web/backend-auth |
606 | 606 | $iss = $payload['iss']; |
607 | - if ($issuer && !in_array($iss, (array) $issuer)) { |
|
607 | + if ($issuer && ! in_array($iss, (array) $issuer)) { |
|
608 | 608 | throw new MonsterInsights_GA_Lib_Auth_Exception( |
609 | 609 | sprintf( |
610 | 610 | "Invalid issuer, %s not in %s: %s", |
611 | 611 | $iss, |
612 | - "[".implode(",", (array) $issuer)."]", |
|
612 | + "[" . implode(",", (array) $issuer) . "]", |
|
613 | 613 | $json_body |
614 | 614 | ) |
615 | 615 | ); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | use google\appengine\api\app_identity\AppIdentityService; |
24 | 24 | |
25 | -if (!class_exists('MonsterInsights_GA_Lib_Client')) { |
|
25 | +if ( ! class_exists('MonsterInsights_GA_Lib_Client')) { |
|
26 | 26 | require_once dirname(__FILE__) . '/../autoload.php'; |
27 | 27 | } |
28 | 28 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | $this->token = $this->client->getCache()->get($cacheKey); |
61 | - if (!$this->token) { |
|
61 | + if ( ! $this->token) { |
|
62 | 62 | $this->retrieveToken($scopes, $cacheKey); |
63 | 63 | } else if ($this->token['expiration_time'] < time()) { |
64 | 64 | $this->client->getCache()->delete($cacheKey); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | public function sign(MonsterInsights_GA_Lib_Http_Request $request) |
105 | 105 | { |
106 | - if (!$this->token) { |
|
106 | + if ( ! $this->token) { |
|
107 | 107 | // No token, so nothing to do. |
108 | 108 | return $request; |
109 | 109 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * limitations under the License. |
16 | 16 | */ |
17 | 17 | |
18 | -if (!class_exists('MonsterInsights_GA_Lib_Client')) { |
|
18 | +if ( ! class_exists('MonsterInsights_GA_Lib_Client')) { |
|
19 | 19 | require_once dirname(__FILE__) . '/../autoload.php'; |
20 | 20 | } |
21 | 21 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * limitations under the License. |
16 | 16 | */ |
17 | 17 | |
18 | -if (!class_exists('MonsterInsights_GA_Lib_Client')) { |
|
18 | +if ( ! class_exists('MonsterInsights_GA_Lib_Client')) { |
|
19 | 19 | require_once dirname(__FILE__) . '/../autoload.php'; |
20 | 20 | } |
21 | 21 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * limitations under the License. |
16 | 16 | */ |
17 | 17 | |
18 | -if (!class_exists('MonsterInsights_GA_Lib_Client')) { |
|
18 | +if ( ! class_exists('MonsterInsights_GA_Lib_Client')) { |
|
19 | 19 | require_once dirname(__FILE__) . '/../autoload.php'; |
20 | 20 | } |
21 | 21 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * limitations under the License. |
16 | 16 | */ |
17 | 17 | |
18 | -if (!class_exists('MonsterInsights_GA_Lib_Client')) { |
|
18 | +if ( ! class_exists('MonsterInsights_GA_Lib_Client')) { |
|
19 | 19 | require_once dirname(__FILE__) . '/../autoload.php'; |
20 | 20 | } |
21 | 21 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * limitations under the License. |
16 | 16 | */ |
17 | 17 | |
18 | -if (!class_exists('MonsterInsights_GA_Lib_Client')) { |
|
18 | +if ( ! class_exists('MonsterInsights_GA_Lib_Client')) { |
|
19 | 19 | require_once dirname(__FILE__) . '/../autoload.php'; |
20 | 20 | } |
21 | 21 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * limitations under the License. |
16 | 16 | */ |
17 | 17 | |
18 | -if (!class_exists('MonsterInsights_GA_Lib_Client')) { |
|
18 | +if ( ! class_exists('MonsterInsights_GA_Lib_Client')) { |
|
19 | 19 | require_once dirname(__FILE__) . '/../autoload.php'; |
20 | 20 | } |
21 | 21 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $this->maxAttempts += $config['retries']; |
140 | 140 | } |
141 | 141 | |
142 | - if (!is_callable($action)) { |
|
142 | + if ( ! is_callable($action)) { |
|
143 | 143 | throw new MonsterInsights_GA_Lib_Task_Exception( |
144 | 144 | 'Task argument `$action` must be a valid callable.' |
145 | 145 | ); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } catch (MonsterInsights_GA_Lib_Task_Retryable $exception) { |
176 | 176 | $allowedRetries = $exception->allowedRetries(); |
177 | 177 | |
178 | - if (!$this->canAttmpt() || !$allowedRetries) { |
|
178 | + if ( ! $this->canAttmpt() || ! $allowedRetries) { |
|
179 | 179 | throw $exception; |
180 | 180 | } |
181 | 181 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function attempt() |
202 | 202 | { |
203 | - if (!$this->canAttmpt()) { |
|
203 | + if ( ! $this->canAttmpt()) { |
|
204 | 204 | return false; |
205 | 205 | } |
206 | 206 |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | ) |
131 | 131 | ), |
132 | 132 | 'MonsterInsights_GA_Lib_IO_Exception' => array( |
133 | - 'retry_map' => !extension_loaded('curl') ? array() : array( |
|
133 | + 'retry_map' => ! extension_loaded('curl') ? array() : array( |
|
134 | 134 | CURLE_COULDNT_RESOLVE_HOST => self::TASK_RETRY_ALWAYS, |
135 | 135 | CURLE_COULDNT_CONNECT => self::TASK_RETRY_ALWAYS, |
136 | 136 | CURLE_OPERATION_TIMEOUTED => self::TASK_RETRY_ALWAYS, |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function setClassConfig($class, $config, $value = null) |
168 | 168 | { |
169 | - if (!is_array($config)) { |
|
170 | - if (!isset($this->configuration['classes'][$class])) { |
|
169 | + if ( ! is_array($config)) { |
|
170 | + if ( ! isset($this->configuration['classes'][$class])) { |
|
171 | 171 | $this->configuration['classes'][$class] = array(); |
172 | 172 | } |
173 | 173 | $this->configuration['classes'][$class][$config] = $value; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | |
179 | 179 | public function getClassConfig($class, $key = null) |
180 | 180 | { |
181 | - if (!isset($this->configuration['classes'][$class])) { |
|
181 | + if ( ! isset($this->configuration['classes'][$class])) { |
|
182 | 182 | return null; |
183 | 183 | } |
184 | 184 | if ($key === null) { |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | public function setAuthClass($class) |
224 | 224 | { |
225 | 225 | $prev = $this->configuration['auth_class']; |
226 | - if (!isset($this->configuration['classes'][$class]) && |
|
226 | + if ( ! isset($this->configuration['classes'][$class]) && |
|
227 | 227 | isset($this->configuration['classes'][$prev])) { |
228 | 228 | $this->configuration['classes'][$class] = |
229 | 229 | $this->configuration['classes'][$prev]; |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | public function setIoClass($class) |
240 | 240 | { |
241 | 241 | $prev = $this->configuration['io_class']; |
242 | - if (!isset($this->configuration['classes'][$class]) && |
|
242 | + if ( ! isset($this->configuration['classes'][$class]) && |
|
243 | 243 | isset($this->configuration['classes'][$prev])) { |
244 | 244 | $this->configuration['classes'][$class] = |
245 | 245 | $this->configuration['classes'][$prev]; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | public function setCacheClass($class) |
256 | 256 | { |
257 | 257 | $prev = $this->configuration['cache_class']; |
258 | - if (!isset($this->configuration['classes'][$class]) && |
|
258 | + if ( ! isset($this->configuration['classes'][$class]) && |
|
259 | 259 | isset($this->configuration['classes'][$prev])) { |
260 | 260 | $this->configuration['classes'][$class] = |
261 | 261 | $this->configuration['classes'][$prev]; |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | public function setLoggerClass($class) |
272 | 272 | { |
273 | 273 | $prev = $this->configuration['logger_class']; |
274 | - if (!isset($this->configuration['classes'][$class]) && |
|
274 | + if ( ! isset($this->configuration['classes'][$class]) && |
|
275 | 275 | isset($this->configuration['classes'][$prev])) { |
276 | 276 | $this->configuration['classes'][$class] = |
277 | 277 | $this->configuration['classes'][$prev]; |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | */ |
449 | 449 | private function setAuthConfig($key, $value) |
450 | 450 | { |
451 | - if (!isset($this->configuration['classes'][$this->getAuthClass()])) { |
|
451 | + if ( ! isset($this->configuration['classes'][$this->getAuthClass()])) { |
|
452 | 452 | $this->configuration['classes'][$this->getAuthClass()] = array(); |
453 | 453 | } |
454 | 454 | $this->configuration['classes'][$this->getAuthClass()][$key] = $value; |