Completed
Push — master ( fed072...89d815 )
by Oleg
16:38
created
lib/WebMarketingROI/OptimizelyPHP/Service/v2/Experiments.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,17 +39,17 @@  discard block
 block discarded – undo
39 39
      * @return Result
40 40
      * @throws Exception
41 41
      */
42
-    public function listAll($projectId, $campaignId=null, $includeClassic=false, $page=1, $perPage=25)
42
+    public function listAll($projectId, $campaignId = null, $includeClassic = false, $page = 1, $perPage = 25)
43 43
     {
44
-        if ($projectId==null && $campaignId==null) {
44
+        if ($projectId == null && $campaignId == null) {
45 45
             throw new Exception('Project ID or Campaign ID must be non-null');
46 46
         }
47 47
         
48
-        if ($page<0) {
48
+        if ($page < 0) {
49 49
             throw new Exception('Invalid page number passed');
50 50
         }
51 51
         
52
-        if ($perPage<0 || $perPage>100) {
52
+        if ($perPage < 0 || $perPage > 100) {
53 53
             throw new Exception('Invalid page size passed');
54 54
         }
55 55
         
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
                     Exception::CODE_INVALID_ARG);
86 86
         }
87 87
         
88
-        if ($experimentId<0) {
88
+        if ($experimentId < 0) {
89 89
             throw new Exception("A positive experiment ID expected");
90 90
         }
91 91
         
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
                     Exception::CODE_INVALID_ARG);
141 141
         }
142 142
         
143
-        if ($action!=null && !is_string($action)) {
143
+        if ($action != null && !is_string($action)) {
144 144
             throw new Exception("Expected string or null action argument",
145 145
                     Exception::CODE_INVALID_ARG);
146 146
         }
147 147
         
148 148
         $queryParams = array();
149
-        if ($action!=null) $queryParams['action'] = $action;
149
+        if ($action != null) $queryParams['action'] = $action;
150 150
         
151 151
         $postData = $experiment->toArray();
152 152
         
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      */
170 170
     public function update($experimentId, $experiment, $action) 
171 171
     {
172
-        if ($experimentId<0) {
172
+        if ($experimentId < 0) {
173 173
             throw new Exception("Expected positive experiment ID argument");
174 174
         }
175 175
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Variation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                 case 'weight': $this->setWeight($value); break;
79 79
                 case 'status': $this->setStatus($value); break;
80 80
                 default:
81
-                    throw new Exception('Unknown option: ' . $name);
81
+                    throw new Exception('Unknown option: '.$name);
82 82
             }
83 83
         }
84 84
     }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         // Remove options with empty values
106 106
         $cleanedOptions = array();
107 107
         foreach ($options as $name=>$value) {
108
-            if ($value!==null)
108
+            if ($value !== null)
109 109
                 $cleanedOptions[$name] = $value;
110 110
         }
111 111
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Project.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
                 case 'socket_token': $this->setSocketToken($value); break;
130 130
                 case 'description': $this->setDescription($value); break;
131 131
                 default:
132
-                    throw new Exception('Unknown option found in the Project entity: ' . $name);
132
+                    throw new Exception('Unknown option found in the Project entity: '.$name);
133 133
             }
134 134
         }
135 135
     }
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
             'platform' => $this->getPlatform(),
148 148
             'sdks' => $this->getSdks(),
149 149
             'status' => $this->getStatus(),
150
-            'web_snippet' => $this->getWebSnippet()?$this->getWebSnippet()->toArray():null,
150
+            'web_snippet' => $this->getWebSnippet() ? $this->getWebSnippet()->toArray() : null,
151 151
             'created' => $this->getCreated(),
152 152
             'id' => $this->getId(),
153 153
             'is_classic' => $this->getIsClassic(),
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         // Remove options with empty values
160 160
         $cleanedOptions = array();
161 161
         foreach ($options as $name=>$value) {
162
-            if ($value!==null)
162
+            if ($value !== null)
163 163
                 $cleanedOptions[$name] = $value;
164 164
         }
165 165
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Experiment.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
                 case 'allocation_policy': $this->setAllocationPolicy($value); break;
193 193
                 case 'earliest': $this->setEarliest($value); break;
194 194
                 default:
195
-                    throw new Exception('Unknown option found in the Experiment entity: ' . $name);
195
+                    throw new Exception('Unknown option found in the Experiment entity: '.$name);
196 196
             }
197 197
         }
198 198
     }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
             'key' => $this->getKey(),
213 213
             'last_modified' => $this->getLastModified(),
214 214
             'name' => $this->getName(),
215
-            'schedule' => $this->getSchedule()?$this->getSchedule()->toArray():null,
215
+            'schedule' => $this->getSchedule() ? $this->getSchedule()->toArray() : null,
216 216
             'status' => $this->getStatus(),            
217 217
             'id' => $this->getId(),
218 218
             'is_classic' => $this->getIsClassic(),
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         // Remove options with empty values
253 253
         $cleanedOptions = array();
254 254
         foreach ($options as $name=>$value) {
255
-            if ($value!==null)
255
+            if ($value !== null)
256 256
                 $cleanedOptions[$name] = $value;
257 257
         }
258 258
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Action.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
                 case 'page_id': $this->setPageId($value); break;
50 50
                 case 'share_link': $this->setShareLink($value); break;
51 51
                 default:
52
-                    throw new Exception('Unknown option found in the Action entity: ' . $name);
52
+                    throw new Exception('Unknown option found in the Action entity: '.$name);
53 53
             }
54 54
         }
55 55
     }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         // Remove options with empty values
73 73
         $cleanedOptions = array();
74 74
         foreach ($options as $name=>$value) {
75
-            if ($value!==null)
75
+            if ($value !== null)
76 76
                 $cleanedOptions[$name] = $value;
77 77
         }
78 78
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Campaign.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
                 case 'id': $this->setId($value); break;
142 142
                 case 'experiment_priorities': $this->setExperimentPriorities($value); break;
143 143
                 default:
144
-                    throw new Exception('Unknown option found in the Campaign entity: ' . $name);
144
+                    throw new Exception('Unknown option found in the Campaign entity: '.$name);
145 145
             }
146 146
         }
147 147
     }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         // Remove options with empty values
181 181
         $cleanedOptions = array();
182 182
         foreach ($options as $name=>$value) {
183
-            if ($value!==null)
183
+            if ($value !== null)
184 184
                 $cleanedOptions[$name] = $value;
185 185
         }
186 186
         
Please login to merge, or discard this patch.
tests/OptimizelyPHPTest/Service/v2/CampaignsTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
         $result = $campaignsService->listAll(1000);
77 77
         $campaigns = $result->getPayload();
78 78
         
79
-        $this->assertTrue(count($campaigns)==1);
79
+        $this->assertTrue(count($campaigns) == 1);
80 80
         $this->assertTrue($campaigns[0] instanceOf Campaign);
81
-        $this->assertTrue($campaigns[0]->getName()=='Landing Page Optimization');        
81
+        $this->assertTrue($campaigns[0]->getName() == 'Landing Page Optimization');        
82 82
     }
83 83
     
84 84
     /**
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         $campaign = $result->getPayload();
173 173
         
174 174
         $this->assertTrue($campaign instanceOf Campaign);
175
-        $this->assertTrue($campaign->getName()=='Landing Page Optimization');        
175
+        $this->assertTrue($campaign->getName() == 'Landing Page Optimization');        
176 176
     }
177 177
     
178 178
     public function testGetResults()
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
         $campaignResults = $result->getPayload();
242 242
         
243 243
         $this->assertTrue($campaignResults instanceOf CampaignResults);
244
-        $this->assertTrue($campaignResults->getConfidenceThreshold()==0);        
245
-        $this->assertTrue($campaignResults->getStartTime()=="2016-10-18T03:27:04.148Z");        
244
+        $this->assertTrue($campaignResults->getConfidenceThreshold() == 0);        
245
+        $this->assertTrue($campaignResults->getStartTime() == "2016-10-18T03:27:04.148Z");        
246 246
     }
247 247
     
248 248
     public function testCreate()
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
         $createdCampaign = $result->getPayload();
350 350
         
351 351
         $this->assertTrue($createdCampaign instanceOf Campaign);
352
-        $this->assertTrue($createdCampaign->getName()=='Landing Page Optimization');                
352
+        $this->assertTrue($createdCampaign->getName() == 'Landing Page Optimization');                
353 353
     }
354 354
     
355 355
     public function testUpdate()
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
         $updatedCampaign = $result->getPayload();
457 457
                  
458 458
         $this->assertTrue($updatedCampaign instanceOf Campaign);
459
-        $this->assertTrue($updatedCampaign->getName()=='Landing Page Optimization');                
459
+        $this->assertTrue($updatedCampaign->getName() == 'Landing Page Optimization');                
460 460
     }
461 461
     
462 462
     public function testDelete()
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
         $credentials = $this->loadCredentialsFromFile();
488 488
         
489 489
         $optimizelyClient = new OptimizelyApiClient($credentials, 'v2');
490
-        $this->assertTrue($optimizelyClient!=null);
490
+        $this->assertTrue($optimizelyClient != null);
491 491
         
492 492
         // Create new project        
493 493
         $curDate = date('Y-m-d H:i:s');
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
         $createdPage = $result->getPayload();
534 534
         
535 535
         $this->assertTrue($createdPage instanceOf Page);
536
-        $this->assertTrue($createdPage->getName()=='Home Page');  
536
+        $this->assertTrue($createdPage->getName() == 'Home Page');  
537 537
         
538 538
         // Create new campaign in the project
539 539
         $campaign = new Campaign(array(
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
         $createdCampaign = $result->getPayload();
573 573
         
574 574
         $this->assertTrue($createdCampaign instanceOf Campaign);
575
-        $this->assertTrue($createdCampaign->getName()=='Landing Page Optimization');  
575
+        $this->assertTrue($createdCampaign->getName() == 'Landing Page Optimization');  
576 576
         
577 577
         // Update campaign
578 578
         $createdCampaign->setName('Some new campaign name');
Please login to merge, or discard this patch.