Completed
Push — master ( f2d606...ed3e7f )
by Oleg
02:59
created
tests/OptimizelyPHPTest/Service/v2/PlanTest.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 
4 4
 use OptimizelyPHPTest\Service\v2\BaseServiceTest;
5 5
 use WebMarketingROI\OptimizelyPHP\OptimizelyApiClient;
6
-use WebMarketingROI\OptimizelyPHP\Exception;
7 6
 use WebMarketingROI\OptimizelyPHP\Result;
8 7
 use WebMarketingROI\OptimizelyPHP\Resource\v2\Plan as PlanResource;
9 8
 use WebMarketingROI\OptimizelyPHP\Service\v2\Plan;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         $plan = $result->getPayload();
47 47
         
48 48
         $this->assertTrue($plan instanceof PlanResource);
49
-        $this->assertTrue($plan->getPlanName()=='premium');        
49
+        $this->assertTrue($plan->getPlanName() == 'premium');        
50 50
     }
51 51
     
52 52
     public function testIntegration()
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         $credentials = $this->loadCredentialsFromFile();
58 58
         
59 59
         $optimizelyClient = new OptimizelyApiClient($credentials, 'v2');
60
-        $this->assertTrue($optimizelyClient!=null);
60
+        $this->assertTrue($optimizelyClient != null);
61 61
        
62 62
         // Retrieve plan        
63 63
         $result = $optimizelyClient->plan()->get();        
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -465,8 +465,9 @@
 block discarded – undo
465 465
     
466 466
     public function testIntegration()
467 467
     {
468
-        if (!getenv('OPTIMIZELY_PHP_TEST_INTEGRATION')) 
469
-            $this->markTestSkipped('OPTIMIZELY_PHP_TEST_INTEGRATION env var is not set');
468
+        if (!getenv('OPTIMIZELY_PHP_TEST_INTEGRATION')) {
469
+                    $this->markTestSkipped('OPTIMIZELY_PHP_TEST_INTEGRATION env var is not set');
470
+        }
470 471
         
471 472
         $credentials = $this->loadCredentialsFromFile();
472 473
         
Please login to merge, or discard this patch.
examples/Plan/GetPlan.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
 use WebMarketingROI\OptimizelyPHP\Exception;
17 17
 
18 18
 // Init class autloading.
19
-include dirname(__FILE__) . '/../../vendor/autoload.php';
19
+include dirname(__FILE__).'/../../vendor/autoload.php';
20 20
 
21 21
 // Include Utils.php - a file containing helper functions
22
-include dirname(__FILE__) . '/../Utils.php';
22
+include dirname(__FILE__).'/../Utils.php';
23 23
 
24 24
 // Get OAuth 2.0 credentials from auth_credentials.json and access_token.json files.
25 25
 $credentials = load_credentials_from_file();
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
     
39 39
     $plan = $result->getPayload();
40 40
 
41
-    echo "Account ID: " . $plan->getAccountId() . "\n";
42
-    echo "Plan Name: " . $plan->getPlanName() . "\n";
43
-    echo "Status: " . $plan->getStatus() . "\n";
44
-    echo "Unit Of Measurement: " . $plan->getUnitOfMeasurement() . "\n";
41
+    echo "Account ID: ".$plan->getAccountId()."\n";
42
+    echo "Plan Name: ".$plan->getPlanName()."\n";
43
+    echo "Status: ".$plan->getStatus()."\n";
44
+    echo "Unit Of Measurement: ".$plan->getUnitOfMeasurement()."\n";
45 45
         
46 46
 } catch (Exception $e) {
47 47
     // Handle error.
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 // Save access token for later use
56 56
 $accessToken = $optimizelyClient->getAccessToken();
57
-file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken));
57
+file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken));
58 58
 
59 59
 echo "Done!\n";
60 60
 
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Event.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                 case 'is_editable': $this->setIsEditable($value); break;                
140 140
                 case 'config': $this->setConfig(new InPageEventConfig($value)); break;
141 141
                 default:
142
-                    throw new Exception('Unknown option found in the Event entity: ' . $name);
142
+                    throw new Exception('Unknown option found in the Event entity: '.$name);
143 143
             }
144 144
         }
145 145
     }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
             'created' => $this->getCreated(),
157 157
             'last_modified' => $this->getLastModified(),
158 158
             'description' => $this->getDescription(),
159
-            'event_filter' => $this->getEventFilter()?$this->getEventFilter()->toArray():null,
159
+            'event_filter' => $this->getEventFilter() ? $this->getEventFilter()->toArray() : null,
160 160
             'event_type' => $this->getEventType(),
161 161
             'key' => $this->getKey(),
162 162
             'name' => $this->getName(),
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
             'id' => $this->getId(),
166 166
             'is_classic' => $this->getIsClassic(),
167 167
             'is_editable' => $this->getIsEditable(),            
168
-            'config' => $this->getConfig()?$this->getConfig()->toArray():null,
168
+            'config' => $this->getConfig() ? $this->getConfig()->toArray() : null,
169 169
         );
170 170
         
171 171
         // Remove options with empty values
172 172
         $cleanedOptions = array();
173 173
         foreach ($options as $name=>$value) {
174
-            if ($value!==null)
174
+            if ($value !== null)
175 175
                 $cleanedOptions[$name] = $value;
176 176
         }
177 177
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Plan.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                 case 'status': $this->setStatus($value); break;
63 63
                 case 'unit_of_measurement': $this->setUnitOfMeasurement($value); break;
64 64
                 default:
65
-                    throw new Exception('Unknown option found in the Plan entity: ' . $name);
65
+                    throw new Exception('Unknown option found in the Plan entity: '.$name);
66 66
             }
67 67
         }
68 68
     }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         // Remove options with empty values
88 88
         $cleanedOptions = array();
89 89
         foreach ($options as $name=>$value) {
90
-            if ($value!==null)
90
+            if ($value !== null)
91 91
                 $cleanedOptions[$name] = $value;
92 92
         }
93 93
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/ProductUsage.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                 case 'usage': $this->setUsage($value); break;
93 93
                 case 'usage_allowance': $this->setUsageAllowance($value); break;
94 94
                 default:
95
-                    throw new Exception('Unknown option found in the ProductUsage entity: ' . $name);
95
+                    throw new Exception('Unknown option found in the ProductUsage entity: '.$name);
96 96
             }
97 97
         }
98 98
     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         // Remove options with empty values
118 118
         $cleanedOptions = array();
119 119
         foreach ($options as $name=>$value) {
120
-            if ($value!==null)
120
+            if ($value !== null)
121 121
                 $cleanedOptions[$name] = $value;
122 122
         }
123 123
         
Please login to merge, or discard this patch.