Completed
Push — master ( 4f84cc...331858 )
by Oleg
02:30
created
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/CampaignResults.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,8 +91,9 @@
 block discarded – undo
91 91
         // Remove options with empty values
92 92
         $cleanedOptions = array();
93 93
         foreach ($options as $name=>$value) {
94
-            if ($value!==null)
95
-                $cleanedOptions[$name] = $value;
94
+            if ($value!==null) {
95
+                            $cleanedOptions[$name] = $value;
96
+            }
96 97
         }
97 98
         
98 99
         return $cleanedOptions;
Please login to merge, or discard this patch.
examples/Projects/GetProjects.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,8 +55,9 @@
 block discarded – undo
55 55
         }
56 56
         
57 57
         // Determine if there are more projects.
58
-        if ($result->getNextPage()==null)
59
-            break;
58
+        if ($result->getNextPage()==null) {
59
+                    break;
60
+        }
60 61
         
61 62
         // Increment page counter.
62 63
         $page ++;
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/OptimizelyApiClient.php 1 patch
Braces   +13 added lines, -8 removed lines patch added patch discarded remove patch
@@ -265,8 +265,10 @@  discard block
 block discarded – undo
265 265
         $headers = explode("\n", $headers);
266 266
         $parsedHeaders = array();
267 267
         foreach ($headers as $i=>$header) {
268
-            if ($i==0)
269
-                continue; // Skip first line (http code).
268
+            if ($i==0) {
269
+                            continue;
270
+            }
271
+            // Skip first line (http code).
270 272
             $pos = strpos($header, ':');
271 273
             if ($pos!=false) {
272 274
                 $headerName = trim(strtolower(substr($header, 0, $pos)));
@@ -419,14 +421,17 @@  discard block
 block discarded – undo
419 421
      */
420 422
     private function getAccessTokenByRefreshToken()
421 423
     {
422
-        if (!isset($this->authCredentials['client_id']))
423
-            throw new Exception('OAuth 2.0 client ID is not set');
424
+        if (!isset($this->authCredentials['client_id'])) {
425
+                    throw new Exception('OAuth 2.0 client ID is not set');
426
+        }
424 427
         
425
-        if (!isset($this->authCredentials['client_secret']))
426
-            throw new Exception('OAuth 2.0 client secret is not set');
428
+        if (!isset($this->authCredentials['client_secret'])) {
429
+                    throw new Exception('OAuth 2.0 client secret is not set');
430
+        }
427 431
         
428
-        if (!isset($this->authCredentials['refresh_token']))
429
-            throw new Exception('Refresh token is not set');
432
+        if (!isset($this->authCredentials['refresh_token'])) {
433
+                    throw new Exception('Refresh token is not set');
434
+        }
430 435
         
431 436
         $clientId = $this->authCredentials['client_id'];
432 437
         $clientSecret = $this->authCredentials['client_secret'];
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Exception.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -55,20 +55,25 @@
 block discarded – undo
55 55
     {
56 56
         parent::__construct($message, $code);
57 57
         
58
-        if (isset($options['http_code']))
59
-            $this->setHttpCode($options['http_code']);
58
+        if (isset($options['http_code'])) {
59
+                    $this->setHttpCode($options['http_code']);
60
+        }
60 61
                 
61
-        if (isset($options['uuid']))
62
-            $this->setUuid($options['uuid']);
62
+        if (isset($options['uuid'])) {
63
+                    $this->setUuid($options['uuid']);
64
+        }
63 65
         
64
-        if (isset($options['rate_limit']))
65
-            $this->setRateLimit($options['rate_limit']);
66
+        if (isset($options['rate_limit'])) {
67
+                    $this->setRateLimit($options['rate_limit']);
68
+        }
66 69
         
67
-        if (isset($options['rate_limit_remaining']))
68
-            $this->setRateLimitRemaining($options['rate_limit_remaining']);
70
+        if (isset($options['rate_limit_remaining'])) {
71
+                    $this->setRateLimitRemaining($options['rate_limit_remaining']);
72
+        }
69 73
         
70
-        if (isset($options['rate_limit_reset']))
71
-            $this->setRateLimitReset($options['rate_limit_reset']);
74
+        if (isset($options['rate_limit_reset'])) {
75
+                    $this->setRateLimitReset($options['rate_limit_reset']);
76
+        }
72 77
     }
73 78
     
74 79
     /**
Please login to merge, or discard this patch.
tests/OptimizelyPHPTest/OptimizelyApiClientTest.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -163,8 +163,7 @@
 block discarded – undo
163 163
         // refresh token, since the provided access token is invalid.
164 164
         try {
165 165
             $result = $client->sendApiRequest('/projects');        
166
-        }
167
-        catch (Exception $e) {
166
+        } catch (Exception $e) {
168 167
             $this->assertEquals(Exception::CODE_API_ERROR, $e->getCode());
169 168
             $this->assertEquals(400, $e->getHttpCode());            
170 169
         }
Please login to merge, or discard this patch.
tests/OptimizelyPHPTest/Service/v2/ProjectsTest.php 1 patch
Braces   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -324,8 +324,9 @@  discard block
 block discarded – undo
324 324
     
325 325
     public function testIntegration()
326 326
     {
327
-        if (!getenv('OPTIMIZELY_PHP_TEST_INTEGRATION')) 
328
-            $this->markTestSkipped('OPTIMIZELY_PHP_TEST_INTEGRATION env var is not set');
327
+        if (!getenv('OPTIMIZELY_PHP_TEST_INTEGRATION')) {
328
+                    $this->markTestSkipped('OPTIMIZELY_PHP_TEST_INTEGRATION env var is not set');
329
+        }
329 330
         
330 331
         $credentials = $this->loadCredentialsFromFile();
331 332
         
@@ -387,13 +388,13 @@  discard block
 block discarded – undo
387 388
                     }
388 389
                 }
389 390
 
390
-                if ($result->getNextPage()==null)
391
-                    break;
391
+                if ($result->getNextPage()==null) {
392
+                                    break;
393
+                }
392 394
 
393 395
                 $page ++;
394 396
             }
395
-        }
396
-        catch (Exception $e) {
397
+        } catch (Exception $e) {
397 398
             // Handle error.
398 399
             $code = $e->getCode();
399 400
             $httpCode = $e->getHttpCode();
@@ -407,8 +408,7 @@  discard block
 block discarded – undo
407 408
         // Try a non-existing project by ID - assume failure
408 409
         try {
409 410
             $result = $optimizelyClient->projects()->get(12345678);        
410
-        } 
411
-        catch(Exception $e) {
411
+        } catch(Exception $e) {
412 412
             //print_r($optimizelyClient->getDiagnosticsInfo());
413 413
             $this->assertEquals(Exception::CODE_API_ERROR, $e->getCode());
414 414
             $this->assertEquals('not_found', $e->getHttpCode());
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/ExperimentVariationReach.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,8 +91,9 @@
 block discarded – undo
91 91
         // Remove options with empty values
92 92
         $cleanedOptions = array();
93 93
         foreach ($options as $name=>$value) {
94
-            if ($value!==null)
95
-                $cleanedOptions[$name] = $value;
94
+            if ($value!==null) {
95
+                            $cleanedOptions[$name] = $value;
96
+            }
96 97
         }
97 98
         
98 99
         return $cleanedOptions;
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Datapoint.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,8 +91,9 @@
 block discarded – undo
91 91
         // Remove options with empty values
92 92
         $cleanedOptions = array();
93 93
         foreach ($options as $name=>$value) {
94
-            if ($value!==null)
95
-                $cleanedOptions[$name] = $value;
94
+            if ($value!==null) {
95
+                            $cleanedOptions[$name] = $value;
96
+            }
96 97
         }
97 98
         
98 99
         return $cleanedOptions;
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Action.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,8 +91,9 @@
 block discarded – undo
91 91
         // Remove options with empty values
92 92
         $cleanedOptions = array();
93 93
         foreach ($options as $name=>$value) {
94
-            if ($value!==null)
95
-                $cleanedOptions[$name] = $value;
94
+            if ($value!==null) {
95
+                            $cleanedOptions[$name] = $value;
96
+            }
96 97
         }
97 98
         
98 99
         return $cleanedOptions;
Please login to merge, or discard this patch.