Completed
Push — master ( 4f84cc...331858 )
by Oleg
02:30
created
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Experiment.php 3 patches
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.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -346,6 +346,9 @@
 block discarded – undo
346 346
         return $this->schedule;
347 347
     }
348 348
     
349
+    /**
350
+     * @param Schedule $schedule
351
+     */
349 352
     public function setSchedule($schedule)
350 353
     {
351 354
         $this->schedule = $schedule;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
                 case 'type': $this->setType($value); break;
179 179
                 case 'audience_conditions': $this->setAudienceConditions($value); break;                
180 180
                 default:
181
-                    throw new Exception('Unknown option found in the Experiment entity: ' . $name);
181
+                    throw new Exception('Unknown option found in the Experiment entity: '.$name);
182 182
             }
183 183
         }
184 184
     }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
             'key' => $this->getKey(),
199 199
             'last_modified' => $this->getLastModified(),
200 200
             'name' => $this->getName(),
201
-            'schedule' => $this->getSchedule()?$this->getSchedule()->toArray():null,
201
+            'schedule' => $this->getSchedule() ? $this->getSchedule()->toArray() : null,
202 202
             'status' => $this->getStatus(),            
203 203
             'id' => $this->getId(),
204 204
             'is_classic' => $this->getIsClassic(),
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
         // Remove options with empty values
237 237
         $cleanedOptions = array();
238 238
         foreach ($options as $name=>$value) {
239
-            if ($value!==null)
239
+            if ($value !== null)
240 240
                 $cleanedOptions[$name] = $value;
241 241
         }
242 242
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Page.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                 case 'id': $this->setId($value); break;
85 85
                 case 'last_modified': $this->setLastModified($value); break;
86 86
                 default:
87
-                    throw new Exception('Unknown option: ' . $name);
87
+                    throw new Exception('Unknown option: '.$name);
88 88
             }
89 89
         }
90 90
     }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         // Remove options with empty values
110 110
         $cleanedOptions = array();
111 111
         foreach ($options as $name=>$value) {
112
-            if ($value!==null)
112
+            if ($value !== null)
113 113
                 $cleanedOptions[$name] = $value;
114 114
         }
115 115
         
Please login to merge, or discard this 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.
tests/OptimizelyPHPTest/Service/v2/CampaignsTest.php 4 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace OptimizelyPHPTest\Service\v2;
3 3
 
4
-use PHPUnit_Framework_TestCase;
5 4
 use WebMarketingROI\OptimizelyPHP\OptimizelyApiClient;
6 5
 use WebMarketingROI\OptimizelyPHP\Result;
7 6
 use WebMarketingROI\OptimizelyPHP\Service\v2\Campaigns;
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.
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
                         array(
24 24
                             "project_id" => 1000,
25 25
                             "changes" => array(
26
-                              array(
26
+                                array(
27 27
                                 "type" => "custom_code",
28 28
                                 "allow_additional_redirect" => true,
29 29
                                 "async" => true,
30 30
                                 "selector" => "a[href*=\"optimizely\"]",
31 31
                                 "dependencies" => array(
32
-                                  24,
33
-                                  26
32
+                                    24,
33
+                                    26
34 34
                                 ),
35 35
                                 "destination" => "https://app.optimizely.com/",
36 36
                                 "extension_id" => 1234,
@@ -38,32 +38,32 @@  discard block
 block discarded – undo
38 38
                                 "src" => 524,
39 39
                                 "value" => "window.someGlobalFunction();",
40 40
                                 "id" => "string"
41
-                              )
41
+                                )
42 42
                             ),
43 43
                             "created" => "2016-10-18T03:27:04.123Z",
44 44
                             "earliest" => "2016-10-18T03:27:04.123Z",
45 45
                             "experiment_ids" => array(
46
-                              0
46
+                                0
47 47
                             ),
48 48
                             "holdback" => 0,
49 49
                             "last_modified" => "2016-10-18T03:27:04.123Z",
50 50
                             "latest" => "2016-10-18T03:27:04.123Z",
51 51
                             "metrics" => array(
52
-                              array(
52
+                                array(
53 53
                                 "aggregator" => "unique",
54 54
                                 "event_id" => 0,
55 55
                                 "field" => "revenue",
56 56
                                 "scope" => "session"
57
-                              )
57
+                                )
58 58
                             ),
59 59
                             "name" => "Landing Page Optimization",
60 60
                             "page_ids" => array(
61
-                              0
61
+                                0
62 62
                             ),
63 63
                             "status" => "active",
64 64
                             "type" => "a/b",
65 65
                             "id" => 2000
66
-                          )
66
+                            )
67 67
                         ), 200);
68 68
         
69 69
         $optimizelyApiClientMock->method('sendApiRequest')
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
         $result = new Result(array(
120 120
                             "project_id" => 1000,
121 121
                             "changes" => array(
122
-                              array(
122
+                                array(
123 123
                                 "type" => "custom_code",
124 124
                                 "allow_additional_redirect" => true,
125 125
                                 "async" => true,
126 126
                                 "selector" => "a[href*=\"optimizely\"]",
127 127
                                 "dependencies" => array(
128
-                                  24,
129
-                                  26
128
+                                    24,
129
+                                    26
130 130
                                 ),
131 131
                                 "destination" => "https://app.optimizely.com/",
132 132
                                 "extension_id" => 1234,
@@ -134,27 +134,27 @@  discard block
 block discarded – undo
134 134
                                 "src" => 524,
135 135
                                 "value" => "window.someGlobalFunction();",
136 136
                                 "id" => "string"
137
-                              )
137
+                                )
138 138
                             ),
139 139
                             "created" => "2016-10-18T03:27:04.139Z",
140 140
                             "earliest" => "2016-10-18T03:27:04.139Z",
141 141
                             "experiment_ids" => array(
142
-                              0
142
+                                0
143 143
                             ),
144 144
                             "holdback" => 0,
145 145
                             "last_modified" => "2016-10-18T03:27:04.139Z",
146 146
                             "latest" => "2016-10-18T03:27:04.139Z",
147 147
                             "metrics" => array(
148
-                              array(
148
+                                array(
149 149
                                 "aggregator" => "unique",
150 150
                                 "event_id" => 0,
151 151
                                 "field" => "revenue",
152 152
                                 "scope" => "session"
153
-                              )
153
+                                )
154 154
                             ),
155 155
                             "name" => "Landing Page Optimization",
156 156
                             "page_ids" => array(
157
-                              0
157
+                                0
158 158
                             ),
159 159
                             "status" => "active",
160 160
                             "type" => "a/b",
@@ -185,47 +185,47 @@  discard block
 block discarded – undo
185 185
                             "confidence_threshold" => 0,
186 186
                             "end_time" => "2016-10-18T03:27:04.147Z",
187 187
                             "metrics" => array(
188
-                              array(
188
+                                array(
189 189
                                 "event" => "string",
190 190
                                 "event_name" => "string",
191 191
                                 "measure" => "conversions",
192 192
                                 "metric_id" => "string",
193 193
                                 "priority" => 0,
194 194
                                 "results" => array(
195
-                                  "campaign" => array(
195
+                                    "campaign" => array(
196 196
                                     "experiment_id" => 0,
197 197
                                     "is_baseline" => true,
198 198
                                     "lift" => array(
199
-                                      "confidence_interval" => array(
199
+                                        "confidence_interval" => array(
200 200
                                         0.010399560300730457,
201 201
                                         0.0850821459929161
202
-                                      ),
203
-                                      "is_most_conclusive" => true,
204
-                                      "is_significant" => true,
205
-                                      "significance" => 0,
206
-                                      "value" => 0,
207
-                                      "visitors_remaining" => 0
202
+                                        ),
203
+                                        "is_most_conclusive" => true,
204
+                                        "is_significant" => true,
205
+                                        "significance" => 0,
206
+                                        "value" => 0,
207
+                                        "visitors_remaining" => 0
208 208
                                     ),
209 209
                                     "name" => "Blue Button",
210 210
                                     "rate" => 0,
211 211
                                     "scope" => "variation",
212 212
                                     "total_increase" => array(
213
-                                      "confidence_interval" => array(
213
+                                        "confidence_interval" => array(
214 214
                                         0.010399560300730457,
215 215
                                         0.0850821459929161
216
-                                      ),
217
-                                      "is_most_conclusive" => true,
218
-                                      "is_significant" => true,
219
-                                      "significance" => 0,
220
-                                      "value" => 0,
221
-                                      "visitors_remaining" => 0
216
+                                        ),
217
+                                        "is_most_conclusive" => true,
218
+                                        "is_significant" => true,
219
+                                        "significance" => 0,
220
+                                        "value" => 0,
221
+                                        "visitors_remaining" => 0
222 222
                                     ),
223 223
                                     "value" => 0,
224 224
                                     "variation_id" => "string"
225
-                                  )
225
+                                    )
226 226
                                 ),
227 227
                                 "unit" => "session"
228
-                              )
228
+                                )
229 229
                             ),
230 230
                             "start_time" => "2016-10-18T03:27:04.148Z"
231 231
                         ), 200);
@@ -253,14 +253,14 @@  discard block
 block discarded – undo
253 253
         $result = new Result(array(
254 254
                             "project_id" => 1000,
255 255
                             "changes" => array(
256
-                              array(
256
+                                array(
257 257
                                 "type" => "custom_code",
258 258
                                 "allow_additional_redirect" => true, 
259 259
                                 "async" => true,
260 260
                                 "selector" => "a[href*=\"optimizely\"]",
261 261
                                 "dependencies" => array(
262
-                                  24,
263
-                                  26
262
+                                    24,
263
+                                    26
264 264
                                 ),
265 265
                                 "destination" => "https://app.optimizely.com/",
266 266
                                 "extension_id" => 1234,
@@ -268,27 +268,27 @@  discard block
 block discarded – undo
268 268
                                 "src" => 524,
269 269
                                 "value" => "window.someGlobalFunction();",
270 270
                                 "id" => "string"
271
-                              )
271
+                                )
272 272
                             ),
273 273
                             "created" => "2016-10-18T03:27:04.155Z",
274 274
                             "earliest" => "2016-10-18T03:27:04.155Z",
275 275
                             "experiment_ids" => array(
276
-                              0
276
+                                0
277 277
                             ),
278 278
                             "holdback" => 0,
279 279
                             "last_modified" => "2016-10-18T03:27:04.155Z",
280 280
                             "latest" => "2016-10-18T03:27:04.155Z",
281 281
                             "metrics" => array(
282
-                              array(
282
+                                array(
283 283
                                 "aggregator" => "unique",
284 284
                                 "event_id" => 0,
285 285
                                 "field" => "revenue",
286 286
                                 "scope" => "session"
287
-                              )
287
+                                )
288 288
                             ),
289 289
                             "name" => "Landing Page Optimization",
290 290
                             "page_ids" => array(
291
-                              0
291
+                                0
292 292
                             ),
293 293
                             "status" => "active",
294 294
                             "type" => "a/b",
@@ -303,41 +303,41 @@  discard block
 block discarded – undo
303 303
         $campaign = new Campaign(array(
304 304
                 "project_id" => 1000,
305 305
                 "changes" => array(
306
-                  array(
306
+                    array(
307 307
                     "type" => "custom_code",
308 308
                     "allow_additional_redirect" => true,
309 309
                     "async" => true,
310 310
                     "selector" => "a[href*=\"optimizely\"]",
311 311
                     "dependencies" => array(
312
-                      24,
313
-                      26
312
+                        24,
313
+                        26
314 314
                     ),
315 315
                     "destination" => "https://app.optimizely.com/",
316 316
                     "extension_id" => 1234,
317 317
                     "preserve_parameters" => true,
318 318
                     "src" => 524,
319 319
                     "value" => "window.someGlobalFunction();"
320
-                  )
320
+                    )
321 321
                 ),
322 322
                 "created" => "2016-10-18T03:27:04.067Z",
323 323
                 "earliest" => "2016-10-18T03:27:04.067Z",
324 324
                 "experiment_ids" => array(
325
-                  0
325
+                    0
326 326
                 ),
327 327
                 "holdback" => 0,
328 328
                 "last_modified" => "2016-10-18T03:27:04.067Z",
329 329
                 "latest" => "2016-10-18T03:27:04.067Z",
330 330
                 "metrics" => array(
331
-                  array(
331
+                    array(
332 332
                     "aggregator" => "unique",
333 333
                     "event_id" => 0,
334 334
                     "field" => "revenue",
335 335
                     "scope" => "session"
336
-                  )
336
+                    )
337 337
                 ),
338 338
                 "name" => "Landing Page Optimization",
339 339
                 "page_ids" => array(
340
-                  0
340
+                    0
341 341
                 ),
342 342
                 "status" => "active",
343 343
                 "type" => "a/b"
@@ -360,14 +360,14 @@  discard block
 block discarded – undo
360 360
         $result = new Result(array(
361 361
                             "project_id" => 1000,
362 362
                             "changes" => array(
363
-                              array(
363
+                                array(
364 364
                                 "type" => "custom_code",
365 365
                                 "allow_additional_redirect" => true, 
366 366
                                 "async" => true,
367 367
                                 "selector" => "a[href*=\"optimizely\"]",
368 368
                                 "dependencies" => array(
369
-                                  24,
370
-                                  26
369
+                                    24,
370
+                                    26
371 371
                                 ),
372 372
                                 "destination" => "https://app.optimizely.com/",
373 373
                                 "extension_id" => 1234,
@@ -375,27 +375,27 @@  discard block
 block discarded – undo
375 375
                                 "src" => 524,
376 376
                                 "value" => "window.someGlobalFunction();",
377 377
                                 "id" => "string"
378
-                              )
378
+                                )
379 379
                             ),
380 380
                             "created" => "2016-10-18T03:27:04.155Z",
381 381
                             "earliest" => "2016-10-18T03:27:04.155Z",
382 382
                             "experiment_ids" => array(
383
-                              0
383
+                                0
384 384
                             ),
385 385
                             "holdback" => 0,
386 386
                             "last_modified" => "2016-10-18T03:27:04.155Z",
387 387
                             "latest" => "2016-10-18T03:27:04.155Z",
388 388
                             "metrics" => array(
389
-                              array(
389
+                                array(
390 390
                                 "aggregator" => "unique",
391 391
                                 "event_id" => 0,
392 392
                                 "field" => "revenue",
393 393
                                 "scope" => "session"
394
-                              )
394
+                                )
395 395
                             ),
396 396
                             "name" => "Landing Page Optimization",
397 397
                             "page_ids" => array(
398
-                              0
398
+                                0
399 399
                             ),
400 400
                             "status" => "active",
401 401
                             "type" => "a/b",
@@ -410,41 +410,41 @@  discard block
 block discarded – undo
410 410
         $campaign = new Campaign(array(
411 411
                 "project_id" => 1000,
412 412
                 "changes" => array(
413
-                  array(
413
+                    array(
414 414
                     "type" => "custom_code",
415 415
                     "allow_additional_redirect" => true,
416 416
                     "async" => true,
417 417
                     "selector" => "a[href*=\"optimizely\"]",
418 418
                     "dependencies" => array(
419
-                      24,
420
-                      26
419
+                        24,
420
+                        26
421 421
                     ),
422 422
                     "destination" => "https://app.optimizely.com/",
423 423
                     "extension_id" => 1234,
424 424
                     "preserve_parameters" => true,
425 425
                     "src" => 524,
426 426
                     "value" => "window.someGlobalFunction();"
427
-                  )
427
+                    )
428 428
                 ),
429 429
                 "created" => "2016-10-18T03:27:04.067Z",
430 430
                 "earliest" => "2016-10-18T03:27:04.067Z",
431 431
                 "experiment_ids" => array(
432
-                  0
432
+                    0
433 433
                 ),
434 434
                 "holdback" => 0,
435 435
                 "last_modified" => "2016-10-18T03:27:04.067Z",
436 436
                 "latest" => "2016-10-18T03:27:04.067Z",
437 437
                 "metrics" => array(
438
-                  array(
438
+                    array(
439 439
                     "aggregator" => "unique",
440 440
                     "event_id" => 0,
441 441
                     "field" => "revenue",
442 442
                     "scope" => "session"
443
-                  )
443
+                    )
444 444
                 ),
445 445
                 "name" => "Landing Page Optimization",
446 446
                 "page_ids" => array(
447
-                  0
447
+                    0
448 448
                 ),
449 449
                 "status" => "active",
450 450
                 "type" => "a/b"
@@ -496,14 +496,14 @@  discard block
 block discarded – undo
496 496
             "platform" => "web",
497 497
             "status" => "active",
498 498
             "web_snippet" => array(
499
-              "enable_force_variation" => false,
500
-              "exclude_disabled_experiments" => false,
501
-              "exclude_names" => true,
502
-              "include_jquery" => true,
503
-              "ip_anonymization" => false,
504
-              "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$",
505
-              "library" => "jquery-1.11.3-trim",
506
-              "project_javascript" => "alert(\"Active Experiment\")"
499
+                "enable_force_variation" => false,
500
+                "exclude_disabled_experiments" => false,
501
+                "exclude_names" => true,
502
+                "include_jquery" => true,
503
+                "ip_anonymization" => false,
504
+                "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$",
505
+                "library" => "jquery-1.11.3-trim",
506
+                "project_javascript" => "alert(\"Active Experiment\")"
507 507
             )
508 508
         ));
509 509
         
@@ -514,30 +514,30 @@  discard block
 block discarded – undo
514 514
         $campaign = new Campaign(array(
515 515
                 "project_id" => $createdProject->getId(),
516 516
                 "changes" => array(
517
-                  array(
517
+                    array(
518 518
                     "type" => "custom_code",
519 519
                     "value" => "window.someGlobalFunction();"
520
-                  )
520
+                    )
521 521
                 ),
522 522
                 "created" => "2016-10-18T03:27:04.067Z",
523 523
                 "earliest" => "2016-10-18T03:27:04.067Z",
524 524
                 "experiment_ids" => array(
525
-                  0
525
+                    0
526 526
                 ),
527 527
                 "holdback" => 0,
528 528
                 "last_modified" => "2016-10-18T03:27:04.067Z",
529 529
                 "latest" => "2016-10-18T03:27:04.067Z",
530 530
                 "metrics" => array(
531
-                  array(
531
+                    array(
532 532
                     "aggregator" => "unique",
533 533
                     "event_id" => 0,
534 534
                     "field" => "revenue",
535 535
                     "scope" => "session"
536
-                  )
536
+                    )
537 537
                 ),
538 538
                 "name" => "Landing Page Optimization",
539 539
                 "page_ids" => array(
540
-                  0
540
+                    0
541 541
                 ),
542 542
                 "status" => "not_started",
543 543
                 "type" => "a/b"
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
         $result = $campaignsService->listAll(1000);
75 75
         $campaigns = $result->getPayload();
76 76
         
77
-        $this->assertTrue(count($campaigns)==1);
77
+        $this->assertTrue(count($campaigns) == 1);
78 78
         $this->assertTrue($campaigns[0] instanceOf Campaign);
79
-        $this->assertTrue($campaigns[0]->getName()=='Landing Page Optimization');        
79
+        $this->assertTrue($campaigns[0]->getName() == 'Landing Page Optimization');        
80 80
     }
81 81
     
82 82
     /**
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
         $campaign = $result->getPayload();
171 171
         
172 172
         $this->assertTrue($campaign instanceOf Campaign);
173
-        $this->assertTrue($campaign->getName()=='Landing Page Optimization');        
173
+        $this->assertTrue($campaign->getName() == 'Landing Page Optimization');        
174 174
     }
175 175
     
176 176
     public function testGetResults()
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
         $campaignResults = $result->getPayload();
240 240
         
241 241
         $this->assertTrue($campaignResults instanceOf CampaignResults);
242
-        $this->assertTrue($campaignResults->getConfidenceThreshold()==0);        
243
-        $this->assertTrue($campaignResults->getStartTime()=="2016-10-18T03:27:04.148Z");        
242
+        $this->assertTrue($campaignResults->getConfidenceThreshold() == 0);        
243
+        $this->assertTrue($campaignResults->getStartTime() == "2016-10-18T03:27:04.148Z");        
244 244
     }
245 245
     
246 246
     public function testCreate()
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
         $createdCampaign = $result->getPayload();
348 348
         
349 349
         $this->assertTrue($createdCampaign instanceOf Campaign);
350
-        $this->assertTrue($createdCampaign->getName()=='Landing Page Optimization');                
350
+        $this->assertTrue($createdCampaign->getName() == 'Landing Page Optimization');                
351 351
     }
352 352
     
353 353
     public function testUpdate()
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
         $updatedCampaign = $result->getPayload();
455 455
                  
456 456
         $this->assertTrue($updatedCampaign instanceOf Campaign);
457
-        $this->assertTrue($updatedCampaign->getName()=='Landing Page Optimization');                
457
+        $this->assertTrue($updatedCampaign->getName() == 'Landing Page Optimization');                
458 458
     }
459 459
     
460 460
     public function testDelete()
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
         $credentials = $this->loadCredentialsFromFile();
486 486
         
487 487
         $optimizelyClient = new OptimizelyApiClient($credentials, 'v2');
488
-        $this->assertTrue($optimizelyClient!=null);
488
+        $this->assertTrue($optimizelyClient != null);
489 489
         
490 490
         // Create new project        
491 491
         $curDate = date('Y-m-d H:i:s');
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
         $createdCampaign = $result->getPayload();
548 548
         
549 549
         $this->assertTrue($createdCampaign instanceOf Campaign);
550
-        $this->assertTrue($createdCampaign->getName()=='Landing Page Optimization');  
550
+        $this->assertTrue($createdCampaign->getName() == 'Landing Page Optimization');  
551 551
         
552 552
         // Update campaign
553 553
         $createdCampaign->setName('Some new campaign name');
Please login to merge, or discard this patch.
tests/OptimizelyPHPTest/Service/v2/ExperimentsTest.php 4 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace OptimizelyPHPTest\Service\v2;
3 3
 
4
-use PHPUnit_Framework_TestCase;
5 4
 use WebMarketingROI\OptimizelyPHP\OptimizelyApiClient;
6 5
 use WebMarketingROI\OptimizelyPHP\Result;
7 6
 use WebMarketingROI\OptimizelyPHP\Service\v2\Experiments;
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
         $result = $experimentsService->listAll(1000);
113 113
         $experiments = $result->getPayload();
114 114
         
115
-        $this->assertTrue(count($experiments)==1);
115
+        $this->assertTrue(count($experiments) == 1);
116 116
         $this->assertTrue($experiments[0] instanceOf Experiment);
117
-        $this->assertTrue($experiments[0]->getName()=='Blue Button Experiment');        
117
+        $this->assertTrue($experiments[0]->getName() == 'Blue Button Experiment');        
118 118
     }
119 119
     
120 120
     /**
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         $experiment = $result->getPayload();
261 261
         
262 262
         $this->assertTrue($experiment instanceOf Experiment);
263
-        $this->assertTrue($experiment->getName()=='Blue Button Experiment');        
263
+        $this->assertTrue($experiment->getName() == 'Blue Button Experiment');        
264 264
     }
265 265
     
266 266
     /**
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
         $experimentResults = $result->getPayload();
375 375
         
376 376
         $this->assertTrue($experimentResults instanceOf ExperimentResults);
377
-        $this->assertTrue($experimentResults->getConfidenceThreshold()==0.9);        
377
+        $this->assertTrue($experimentResults->getConfidenceThreshold() == 0.9);        
378 378
     }
379 379
     
380 380
     public function testCreate()
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
         $createdExperiment = $result->getPayload();
552 552
         
553 553
         $this->assertTrue($createdExperiment instanceOf Experiment);
554
-        $this->assertTrue($createdExperiment->getName()=='Blue Button Experiment');                
554
+        $this->assertTrue($createdExperiment->getName() == 'Blue Button Experiment');                
555 555
     }
556 556
     
557 557
     public function testUpdate()
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
         $updatedExperiment = $result->getPayload();
725 725
         
726 726
         $this->assertTrue($updatedExperiment instanceOf Experiment);
727
-        $this->assertTrue($updatedExperiment->getName()=='Blue Button Experiment');                
727
+        $this->assertTrue($updatedExperiment->getName() == 'Blue Button Experiment');                
728 728
     }
729 729
     
730 730
     public function testDelete()
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
         $credentials = $this->loadCredentialsFromFile();
755 755
         
756 756
         $optimizelyClient = new OptimizelyApiClient($credentials, 'v2');
757
-        $this->assertTrue($optimizelyClient!=null);
757
+        $this->assertTrue($optimizelyClient != null);
758 758
         
759 759
         // Create new project        
760 760
         $curDate = date('Y-m-d H:i:s');
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
         $createdExperiment = $result->getPayload();
907 907
         
908 908
         $this->assertTrue($createdExperiment instanceOf Experiment);
909
-        $this->assertTrue($createdExperiment->getName()=='Blue Button Experiment');  
909
+        $this->assertTrue($createdExperiment->getName() == 'Blue Button Experiment');  
910 910
         
911 911
         // List all existing experiments and try to find the created experiment
912 912
         $experimentFound = false;        
@@ -918,16 +918,16 @@  discard block
 block discarded – undo
918 918
                 $experiments = $result->getPayload();
919 919
 
920 920
                 foreach ($experiments as $experiment) {
921
-                    if ($experiment->getName()=="Blue Button Experiment") {
921
+                    if ($experiment->getName() == "Blue Button Experiment") {
922 922
                         $experimentFound = true;
923 923
                         break;
924 924
                     }
925 925
                 }
926 926
 
927
-                if ($result->getNextPage()==null)
927
+                if ($result->getNextPage() == null)
928 928
                     break;
929 929
 
930
-                $page ++;
930
+                $page++;
931 931
             }
932 932
         }
933 933
         catch (Exception $e) {
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
         $updatedExperiment = $result->getPayload();                
948 948
         
949 949
         $this->assertTrue($updatedExperiment instanceOf Experiment);
950
-        $this->assertTrue($updatedExperiment->getName()=='Some new experiment name');  
950
+        $this->assertTrue($updatedExperiment->getName() == 'Some new experiment name');  
951 951
         
952 952
         // Delete experiment        
953 953
         $result = $optimizelyClient->experiments()->delete($createdExperiment->getId());
Please login to merge, or discard this patch.
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -238,8 +238,9 @@  discard block
 block discarded – undo
238 238
     
239 239
     public function testIntegration()
240 240
     {
241
-        if (!getenv('OPTIMIZELY_PHP_TEST_INTEGRATION')) 
242
-            $this->markTestSkipped('OPTIMIZELY_PHP_TEST_INTEGRATION env var is not set');
241
+        if (!getenv('OPTIMIZELY_PHP_TEST_INTEGRATION')) {
242
+                    $this->markTestSkipped('OPTIMIZELY_PHP_TEST_INTEGRATION env var is not set');
243
+        }
243 244
         
244 245
         $credentials = $this->loadCredentialsFromFile();
245 246
         
@@ -301,13 +302,13 @@  discard block
 block discarded – undo
301 302
                     }
302 303
                 }
303 304
 
304
-                if ($result->getNextPage()==null)
305
-                    break;
305
+                if ($result->getNextPage()==null) {
306
+                                    break;
307
+                }
306 308
 
307 309
                 $page ++;
308 310
             }
309
-        }
310
-        catch (Exception $e) {
311
+        } catch (Exception $e) {
311 312
             // Handle error.
312 313
             $code = $e->getCode();
313 314
             $httpCode = $e->getHttpCode();
Please login to merge, or discard this patch.
Indentation   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -27,20 +27,20 @@  discard block
 block discarded – undo
27 27
                         array(
28 28
                             "project_id" => 1000,
29 29
                             "audience_ids" => array(
30
-                              1234,
31
-                              1212,
32
-                              1432
30
+                                1234,
31
+                                1212,
32
+                                1432
33 33
                             ),
34 34
                             "campaign_id" => 2000,
35 35
                             "changes" => array(
36
-                              array(
36
+                                array(
37 37
                                 "type" => "custom_code",
38 38
                                 "allow_additional_redirect" => true,
39 39
                                 "async" => true,
40 40
                                 "selector" => "a[href*=\"optimizely\"]",
41 41
                                 "dependencies" => array(
42
-                                  24,
43
-                                  26
42
+                                    24,
43
+                                    26
44 44
                                 ),
45 45
                                 "destination" => "https://app.optimizely.com/",
46 46
                                 "extension_id" => 1234,
@@ -48,39 +48,39 @@  discard block
 block discarded – undo
48 48
                                 "src" => 524,
49 49
                                 "value" => "window.someGlobalFunction();",
50 50
                                 "id" => "string"
51
-                              )
51
+                                )
52 52
                             ),
53 53
                             "description" => "string",
54 54
                             "holdback" => 5000,
55 55
                             "key" => "home_page_experiment",
56 56
                             "metrics" => array(
57
-                              array(
57
+                                array(
58 58
                                 "aggregator" => "unique",
59 59
                                 "event_id" => 0,
60 60
                                 "field" => "revenue",
61 61
                                 "scope" => "visitor"
62
-                              )
62
+                                )
63 63
                             ),
64 64
                             "name" => "Blue Button Experiment",
65 65
                             "schedule" => array(
66
-                              "start_time" => "2016-10-17T07:05:00.070Z",
67
-                              "stop_time" => "2016-10-17T07:05:00.070Z",
68
-                              "time_zone" => "UTC"
66
+                                "start_time" => "2016-10-17T07:05:00.070Z",
67
+                                "stop_time" => "2016-10-17T07:05:00.070Z",
68
+                                "time_zone" => "UTC"
69 69
                             ),
70 70
                             "status" => "active",
71 71
                             "variations" => array(
72
-                              array(
72
+                                array(
73 73
                                 "actions" => array(
74
-                                  array(
74
+                                    array(
75 75
                                     "changes" => array(
76
-                                      array(
76
+                                        array(
77 77
                                         "type" => "custom_code",
78 78
                                         "allow_additional_redirect" => true, 
79 79
                                         "async" => true,
80 80
                                         "selector" => "a[href*=\"optimizely\"]",
81 81
                                         "dependencies" => array(
82
-                                          24,
83
-                                          26
82
+                                            24,
83
+                                            26
84 84
                                         ),
85 85
                                         "destination" => "https://app.optimizely.com/",
86 86
                                         "extension_id" => 1234,
@@ -88,23 +88,23 @@  discard block
 block discarded – undo
88 88
                                         "src" => 524,
89 89
                                         "value" => "window.someGlobalFunction();",
90 90
                                         "id" => "string"
91
-                                      )
91
+                                        )
92 92
                                     ),
93 93
                                     "page_id" => 0
94
-                                  )
94
+                                    )
95 95
                                 ),
96 96
                                 "archived"=> true,
97 97
                                 "key" => "blue_button_variation",
98 98
                                 "name" => "Blue Button",
99 99
                                 "variation_id" => 0,
100 100
                                 "weight" => 0
101
-                              )
101
+                                )
102 102
                             ),
103 103
                             "created" => "2016-10-17T07:05:00.070Z",
104 104
                             "id" => 3000,
105 105
                             "is_classic" => false,
106 106
                             "last_modified" => "2016-10-17T07:05:00.070Z"
107
-                          )
107
+                            )
108 108
                         ), 200);
109 109
         
110 110
         $optimizelyApiClientMock->method('sendApiRequest')
@@ -175,20 +175,20 @@  discard block
 block discarded – undo
175 175
         $result = new Result(array(
176 176
                             "project_id" => 1000,
177 177
                             "audience_ids" => array(
178
-                              1234,
179
-                              1212,
180
-                              1432
178
+                                1234,
179
+                                1212,
180
+                                1432
181 181
                             ),
182 182
                             "campaign_id" => 2000,
183 183
                             "changes" => array(
184
-                              array(
184
+                                array(
185 185
                                 "type" => "custom_code",
186 186
                                 "allow_additional_redirect" => true,
187 187
                                 "async" => true,
188 188
                                 "selector" => "a[href*=\"optimizely\"]",
189 189
                                 "dependencies" => array(
190
-                                  24,
191
-                                  26
190
+                                    24,
191
+                                    26
192 192
                                 ),
193 193
                                 "destination" => "https://app.optimizely.com/",
194 194
                                 "extension_id" => 1234,
@@ -196,39 +196,39 @@  discard block
 block discarded – undo
196 196
                                 "src" => 524,
197 197
                                 "value" => "window.someGlobalFunction();",
198 198
                                 "id" => "string"
199
-                              )
199
+                                )
200 200
                             ),
201 201
                             "description" => "string",
202 202
                             "holdback" => 5000,
203 203
                             "key" => "home_page_experiment",
204 204
                             "metrics" => array(
205
-                              array(
205
+                                array(
206 206
                                 "aggregator" => "unique",
207 207
                                 "event_id" => 0,
208 208
                                 "field" => "revenue",
209 209
                                 "scope" => "session"
210
-                              )
210
+                                )
211 211
                             ),
212 212
                             "name" => "Blue Button Experiment",
213 213
                             "schedule" => array(
214
-                              "start_time" => "2016-10-17T07:05:00.070Z",
215
-                              "stop_time" => "2016-10-17T07:05:00.070Z",
216
-                              "time_zone" => "UTC"
214
+                                "start_time" => "2016-10-17T07:05:00.070Z",
215
+                                "stop_time" => "2016-10-17T07:05:00.070Z",
216
+                                "time_zone" => "UTC"
217 217
                             ),
218 218
                             "status" => "active",
219 219
                             "variations" => array(
220
-                              array(
220
+                                array(
221 221
                                 "actions" => array(
222
-                                  array(
222
+                                    array(
223 223
                                     "changes" => array(
224
-                                      array(
224
+                                        array(
225 225
                                         "type" => "custom_code",
226 226
                                         "allow_additional_redirect" => true, 
227 227
                                         "async" => true,
228 228
                                         "selector" => "a[href*=\"optimizely\"]",
229 229
                                         "dependencies" => array(
230
-                                          24,
231
-                                          26
230
+                                            24,
231
+                                            26
232 232
                                         ),
233 233
                                         "destination" => "https://app.optimizely.com/",
234 234
                                         "extension_id" => 1234,
@@ -236,23 +236,23 @@  discard block
 block discarded – undo
236 236
                                         "src" => 524,
237 237
                                         "value" => "window.someGlobalFunction();",
238 238
                                         "id" => "string"
239
-                                      )
239
+                                        )
240 240
                                     ),
241 241
                                     "page_id" => 0
242
-                                  )
242
+                                    )
243 243
                                 ),
244 244
                                 "archived"=> true,
245 245
                                 "key" => "blue_button_variation",
246 246
                                 "name" => "Blue Button",
247 247
                                 "variation_id" => 0,
248 248
                                 "weight" => 0
249
-                              )
249
+                                )
250 250
                             ),
251 251
                             "created" => "2016-10-17T07:05:00.070Z",
252 252
                             "id" => 3000,
253 253
                             "is_classic" => false,
254 254
                             "last_modified" => "2016-10-17T07:05:00.070Z"
255
-                          ), 200);
255
+                            ), 200);
256 256
         
257 257
         $optimizelyApiClientMock->method('sendApiRequest')
258 258
                     ->willReturn($result);
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
                             "end_time" => "2016-10-17T07:05:00.089Z",
309 309
                             "experiment_id" => 3000,
310 310
                             "metrics" => array(
311
-                              array(
311
+                                array(
312 312
                                 "event" => "string",
313 313
                                 "event_name" => "string",
314 314
                                 "measure" => "conversions",
@@ -316,54 +316,54 @@  discard block
 block discarded – undo
316 316
                                 "priority" => 1,
317 317
                                 "unit" => "session",
318 318
                                 "variation_results" => array(
319
-                                  "9000" => array(
319
+                                    "9000" => array(
320 320
                                     "experiment_id" => 0,
321 321
                                     "is_baseline" => true,
322 322
                                     "lift" => array(
323
-                                      "confidence_interval" => array(
323
+                                        "confidence_interval" => array(
324 324
                                         0.010399560300730457,
325 325
                                         0.0850821459929161
326
-                                      ),
327
-                                      "is_most_conclusive" => true,
328
-                                      "is_significant" => true,
329
-                                      "significance" => 0,
330
-                                      "value" => 0,
331
-                                      "visitors_remaining" => 0
326
+                                        ),
327
+                                        "is_most_conclusive" => true,
328
+                                        "is_significant" => true,
329
+                                        "significance" => 0,
330
+                                        "value" => 0,
331
+                                        "visitors_remaining" => 0
332 332
                                     ),
333 333
                                     "name" => "Blue Button",
334 334
                                     "rate" => 0,
335 335
                                     "scope" => "variation",
336 336
                                     "total_increase" => array(
337
-                                      "confidence_interval" => array(
337
+                                        "confidence_interval" => array(
338 338
                                         0.010399560300730457,
339 339
                                         0.0850821459929161
340
-                                      ),
341
-                                      "is_most_conclusive" => true,
342
-                                      "is_significant" => true,
343
-                                      "significance" => 0,
344
-                                      "value" => 0,
345
-                                      "visitors_remaining" => 0
340
+                                        ),
341
+                                        "is_most_conclusive" => true,
342
+                                        "is_significant" => true,
343
+                                        "significance" => 0,
344
+                                        "value" => 0,
345
+                                        "visitors_remaining" => 0
346 346
                                     ),
347 347
                                     "value" => 0,
348 348
                                     "variation_id" => "string"
349
-                                  )
349
+                                    )
350
+                                )
350 351
                                 )
351
-                              )
352 352
                             ),
353 353
                             "reach" => array(
354
-                              "baseline_count" => 0,
355
-                              "baseline_reach" => 0,
356
-                              "total_count" => 0,
357
-                              "treatment_count" => 0,
358
-                              "treatment_reach" => 0,
359
-                              "variations" => array(
354
+                                "baseline_count" => 0,
355
+                                "baseline_reach" => 0,
356
+                                "total_count" => 0,
357
+                                "treatment_count" => 0,
358
+                                "treatment_reach" => 0,
359
+                                "variations" => array(
360 360
                                 "9000" => array(
361
-                                  "count" => 0,
362
-                                  "name" => "Blue Button",
363
-                                  "variation_id" => "string",
364
-                                  "variation_reach" => 0
361
+                                    "count" => 0,
362
+                                    "name" => "Blue Button",
363
+                                    "variation_id" => "string",
364
+                                    "variation_reach" => 0
365
+                                )
365 366
                                 )
366
-                              )
367 367
                             ),
368 368
                             "start_time" => "2016-10-17T07:05:00.090Z"
369 369
                         ), 200);
@@ -390,20 +390,20 @@  discard block
 block discarded – undo
390 390
         $result = new Result(array(
391 391
                             "project_id" => 1000,
392 392
                             "audience_ids" => array(
393
-                              1234,
394
-                              1212,
395
-                              1432
393
+                                1234,
394
+                                1212,
395
+                                1432
396 396
                             ),
397 397
                             "campaign_id" => 2000,
398 398
                             "changes" => array(
399
-                              array(
399
+                                array(
400 400
                                 "type" => "custom_code",
401 401
                                 "allow_additional_redirect" => true,
402 402
                                 "async" => true,
403 403
                                 "selector" => "a[href*=\"optimizely\"]",
404 404
                                 "dependencies" => array(
405
-                                  24,
406
-                                  26
405
+                                    24,
406
+                                    26
407 407
                                 ),
408 408
                                 "destination" => "https://app.optimizely.com/",
409 409
                                 "extension_id" => 1234,
@@ -411,39 +411,39 @@  discard block
 block discarded – undo
411 411
                                 "src" => 524,
412 412
                                 "value" => "window.someGlobalFunction();",
413 413
                                 "id" => "string"
414
-                              )
414
+                                )
415 415
                             ),
416 416
                             "description" => "string",
417 417
                             "holdback" => 5000,
418 418
                             "key" => "home_page_experiment",
419 419
                             "metrics" => array(
420
-                              array(
420
+                                array(
421 421
                                 "aggregator" => "unique",
422 422
                                 "event_id" => 0,
423 423
                                 "field" => "revenue",
424 424
                                 "scope" => "session"
425
-                              )
425
+                                )
426 426
                             ),
427 427
                             "name" => "Blue Button Experiment",
428 428
                             "schedule" => array(
429
-                              "start_time" => "2016-10-17T07:05:00.099Z",
430
-                              "stop_time" => "2016-10-17T07:05:00.099Z",
431
-                              "time_zone" => "UTC"
429
+                                "start_time" => "2016-10-17T07:05:00.099Z",
430
+                                "stop_time" => "2016-10-17T07:05:00.099Z",
431
+                                "time_zone" => "UTC"
432 432
                             ),
433 433
                             "status" => "active",
434 434
                             "variations" => array(
435
-                              array(
435
+                                array(
436 436
                                 "actions" => array(
437
-                                  array(
437
+                                    array(
438 438
                                     "changes" => array(
439
-                                      array(
439
+                                        array(
440 440
                                         "type" => "custom_code",
441 441
                                         "allow_additional_redirect" => true,
442 442
                                         "async" => true,
443 443
                                         "selector" => "a[href*=\"optimizely\"]",
444 444
                                         "dependencies" => array(
445
-                                          24,
446
-                                          26
445
+                                            24,
446
+                                            26
447 447
                                         ),
448 448
                                         "destination" => "https://app.optimizely.com/",
449 449
                                         "extension_id" => 1234,
@@ -451,17 +451,17 @@  discard block
 block discarded – undo
451 451
                                         "src" => 524,
452 452
                                         "value" => "window.someGlobalFunction();",
453 453
                                         "id" => "string"
454
-                                      )
454
+                                        )
455 455
                                     ),
456 456
                                     "page_id" => 0
457
-                                  )
457
+                                    )
458 458
                                 ),
459 459
                                 "archived" => true,
460 460
                                 "key" => "blue_button_variation",
461 461
                                 "name" => "Blue Button",
462 462
                                 "variation_id" => 0,
463 463
                                 "weight" => 0
464
-                              )
464
+                                )
465 465
                             ),
466 466
                             "created" => "2016-10-17T07:05:00.099Z",
467 467
                             "id" => 3000,
@@ -477,76 +477,76 @@  discard block
 block discarded – undo
477 477
         $experiment = new Experiment(array(
478 478
             "project_id" => 1000,
479 479
             "audience_ids" => array(
480
-              1234,
481
-              1212,
482
-              1432
480
+                1234,
481
+                1212,
482
+                1432
483 483
             ),
484 484
             "campaign_id" => 2000,
485 485
             "changes" => array(
486
-              array(
486
+                array(
487 487
                 "type" => "custom_code",
488 488
                 "allow_additional_redirect" => true,
489 489
                 "async" => true,
490 490
                 "selector" => "a[href*=\"optimizely\"]",
491 491
                 "dependencies" => array(
492
-                  24,
493
-                  26
492
+                    24,
493
+                    26
494 494
                 ),
495 495
                 "destination" => "https://app.optimizely.com/",
496 496
                 "extension_id" => 1234,
497 497
                 "preserve_parameters" => true,
498 498
                 "src" => 524,
499 499
                 "value" => "window.someGlobalFunction();"
500
-              )
500
+                )
501 501
             ),
502 502
             "description" => "string",
503 503
             "holdback" => 5000,
504 504
             "key" => "home_page_experiment",
505 505
             "metrics" => array(
506
-              array(
506
+                array(
507 507
                 "aggregator" => "unique",
508 508
                 "event_id" => 0,
509 509
                 "field" => "revenue",
510 510
                 "scope" => "session"
511
-              )
511
+                )
512 512
             ),
513 513
             "name" => "Blue Button Experiment",
514 514
             "schedule" => array(
515
-              "start_time" => "2016-10-17T07:04:59.724Z",
516
-              "stop_time" => "2016-10-17T07:04:59.724Z",
517
-              "time_zone" => "UTC"
515
+                "start_time" => "2016-10-17T07:04:59.724Z",
516
+                "stop_time" => "2016-10-17T07:04:59.724Z",
517
+                "time_zone" => "UTC"
518 518
             ),
519 519
             "status" => "active",
520 520
             "variations" => array(
521
-              array(
521
+                array(
522 522
                 "actions" => array(
523
-                  array(
523
+                    array(
524 524
                     "changes" => array(
525
-                      array(
525
+                        array(
526 526
                         "type" => "custom_code",
527 527
                         "allow_additional_redirect" => true,
528 528
                         "async" => true,
529 529
                         "selector" => "a[href*=\"optimizely\"]",
530 530
                         "dependencies" => array(
531
-                          24,
532
-                          26
531
+                            24,
532
+                            26
533 533
                         ),
534 534
                         "destination" => "https://app.optimizely.com/",
535 535
                         "extension_id" => 1234,
536 536
                         "preserve_parameters" => true,
537 537
                         "src" => 524,
538 538
                         "value" => "window.someGlobalFunction();"
539
-                      )
539
+                        )
540 540
                     ),
541 541
                     "page_id" => 0
542
-                  )
542
+                    )
543 543
                 ),
544 544
                 "archived" => true,
545 545
                 "key" => "blue_button_variation",
546 546
                 "name" => "Blue Button",
547 547
                 "variation_id" => 0,
548 548
                 "weight" => 0
549
-              )
549
+                )
550 550
             )
551 551
         ));
552 552
         
@@ -567,20 +567,20 @@  discard block
 block discarded – undo
567 567
         $result = new Result(array(
568 568
                         "project_id" => 1000,
569 569
                         "audience_ids" => array(
570
-                          1234,
571
-                          1212,
572
-                          1432
570
+                            1234,
571
+                            1212,
572
+                            1432
573 573
                         ),
574 574
                         "campaign_id" => 2000,
575 575
                         "changes" => array(
576
-                          array(
576
+                            array(
577 577
                             "type" => "custom_code",
578 578
                             "allow_additional_redirect" => true,
579 579
                             "async" => true,
580 580
                             "selector" => "a[href*=\"optimizely\"]",
581 581
                             "dependencies" => array(
582
-                              24,
583
-                              26
582
+                                24,
583
+                                26
584 584
                             ),
585 585
                             "destination" => "https://app.optimizely.com/",
586 586
                             "extension_id" => 1234,
@@ -588,39 +588,39 @@  discard block
 block discarded – undo
588 588
                             "src" => 524,
589 589
                             "value" => "window.someGlobalFunction();",
590 590
                             "id" => "string"
591
-                          )
591
+                            )
592 592
                         ),
593 593
                         "description" => "string",
594 594
                         "holdback" => 5000,
595 595
                         "key" => "home_page_experiment",
596 596
                         "metrics" => array(
597
-                          array(
597
+                            array(
598 598
                             "aggregator" => "unique",
599 599
                             "event_id" => 0,
600 600
                             "field" => "revenue",
601 601
                             "scope" => "session"
602
-                          )
602
+                            )
603 603
                         ),
604 604
                         "name" => "Blue Button Experiment",
605 605
                         "schedule" => array(
606
-                          "start_time" => "2016-10-17T07:05:00.109Z",
607
-                          "stop_time" => "2016-10-17T07:05:00.109Z",
608
-                          "time_zone" => "UTC"
606
+                            "start_time" => "2016-10-17T07:05:00.109Z",
607
+                            "stop_time" => "2016-10-17T07:05:00.109Z",
608
+                            "time_zone" => "UTC"
609 609
                         ),
610 610
                         "status" => "active",
611 611
                         "variations" => array(
612
-                          array(
612
+                            array(
613 613
                             "actions" => array(
614
-                              array(
614
+                                array(
615 615
                                 "changes" => array(
616
-                                  array(
616
+                                    array(
617 617
                                     "type" => "custom_code",
618 618
                                     "allow_additional_redirect" => true,
619 619
                                     "async" => true,
620 620
                                     "selector" => "a[href*=\"optimizely\"]",
621 621
                                     "dependencies" => array(
622
-                                      24,
623
-                                      26
622
+                                        24,
623
+                                        26
624 624
                                     ),
625 625
                                     "destination" => "https://app.optimizely.com/",
626 626
                                     "extension_id" => 1234,
@@ -628,17 +628,17 @@  discard block
 block discarded – undo
628 628
                                     "src" => 524,
629 629
                                     "value" => "window.someGlobalFunction();",
630 630
                                     "id" => "string"
631
-                                  )
631
+                                    )
632 632
                                 ),
633 633
                                 "page_id" => 0
634
-                              )
634
+                                )
635 635
                             ),
636 636
                             "archived" => true,
637 637
                             "key" => "blue_button_variation",
638 638
                             "name" => "Blue Button",
639 639
                             "variation_id" => 0,
640 640
                             "weight" => 0
641
-                          )
641
+                            )
642 642
                         ),
643 643
                         "created" => "2016-10-17T07:05:00.109Z",
644 644
                         "id" => 3000,
@@ -652,75 +652,75 @@  discard block
 block discarded – undo
652 652
         $experimentsService = new Experiments($optimizelyApiClientMock);
653 653
         
654 654
         $experiment = new Experiment(array(
655
-              "audience_ids" => array(
655
+                "audience_ids" => array(
656 656
                 0
657
-              ),
658
-              "changes" => array(
657
+                ),
658
+                "changes" => array(
659 659
                 array(
660
-                  "type" => "custom_code",
661
-                  "allow_additional_redirect" => true,
662
-                  "async" => true,
663
-                  "selector" => "a[href*=\"optimizely\"]",
664
-                  "dependencies" => array(
660
+                    "type" => "custom_code",
661
+                    "allow_additional_redirect" => true,
662
+                    "async" => true,
663
+                    "selector" => "a[href*=\"optimizely\"]",
664
+                    "dependencies" => array(
665 665
                     24,
666 666
                     26
667
-                  ),
668
-                  "destination" => "https://app.optimizely.com/",
669
-                  "extension_id" => 1234,
670
-                  "preserve_parameters" => true,
671
-                  "src" => 524,
672
-                  "value" => "window.someGlobalFunction();"
667
+                    ),
668
+                    "destination" => "https://app.optimizely.com/",
669
+                    "extension_id" => 1234,
670
+                    "preserve_parameters" => true,
671
+                    "src" => 524,
672
+                    "value" => "window.someGlobalFunction();"
673 673
                 )
674
-              ),
675
-              "description" => "AB Test to see if the Blue Button converts more visitors",
676
-              "holdback" => 0,
677
-              "key" => "home_page_experiment",
678
-              "metrics" => array(
674
+                ),
675
+                "description" => "AB Test to see if the Blue Button converts more visitors",
676
+                "holdback" => 0,
677
+                "key" => "home_page_experiment",
678
+                "metrics" => array(
679 679
                 array(
680
-                  "aggregator" => "unique",
681
-                  "event_id" => 0,
682
-                  "field" => "revenue",
683
-                  "scope" => "session"
680
+                    "aggregator" => "unique",
681
+                    "event_id" => 0,
682
+                    "field" => "revenue",
683
+                    "scope" => "session"
684 684
                 )
685
-              ),
686
-              "name" => "Blue Button Experiment",
687
-              "schedule" => array(
685
+                ),
686
+                "name" => "Blue Button Experiment",
687
+                "schedule" => array(
688 688
                 "start_time" => "2016-10-17T07:04:59.731Z",
689 689
                 "stop_time" => "2016-10-17T07:04:59.731Z",
690 690
                 "time_zone" => "UTC"
691
-              ),
692
-              "status" => "active",
693
-              "variations" => array(
691
+                ),
692
+                "status" => "active",
693
+                "variations" => array(
694 694
                 array(
695
-                  "actions" => array(
695
+                    "actions" => array(
696 696
                     array(
697
-                      "changes" => array(
697
+                        "changes" => array(
698 698
                         array(
699
-                          "type" => "custom_code",
700
-                          "allow_additional_redirect" => true,
701
-                          "async" => true,
702
-                          "selector" => "a[href*=\"optimizely\"]",
703
-                          "dependencies" => array(
699
+                            "type" => "custom_code",
700
+                            "allow_additional_redirect" => true,
701
+                            "async" => true,
702
+                            "selector" => "a[href*=\"optimizely\"]",
703
+                            "dependencies" => array(
704 704
                             24,
705 705
                             26
706
-                          ),
707
-                          "destination" => "https://app.optimizely.com/",
708
-                          "extension_id" => 1234,
709
-                          "preserve_parameters" => true,
710
-                          "src" => 524,
711
-                          "value" => "window.someGlobalFunction();"
706
+                            ),
707
+                            "destination" => "https://app.optimizely.com/",
708
+                            "extension_id" => 1234,
709
+                            "preserve_parameters" => true,
710
+                            "src" => 524,
711
+                            "value" => "window.someGlobalFunction();"
712 712
                         )
713
-                      ),
714
-                      "page_id" => 0
713
+                        ),
714
+                        "page_id" => 0
715 715
                     )
716
-                  ),
717
-                  "archived" => true,
718
-                  "key" => "blue_button_variation",
719
-                  "name" => "Blue Button",
720
-                  "variation_id" => 0,
721
-                  "weight" => 0
716
+                    ),
717
+                    "archived" => true,
718
+                    "key" => "blue_button_variation",
719
+                    "name" => "Blue Button",
720
+                    "variation_id" => 0,
721
+                    "weight" => 0
722
+                )
722 723
                 )
723
-              )
724 724
         ));
725 725
         
726 726
         $result = $experimentsService->update(1000, $experiment, 'start');
@@ -768,14 +768,14 @@  discard block
 block discarded – undo
768 768
             "platform" => "web",
769 769
             "status" => "active",
770 770
             "web_snippet" => array(
771
-              "enable_force_variation" => false,
772
-              "exclude_disabled_experiments" => false,
773
-              "exclude_names" => true,
774
-              "include_jquery" => true,
775
-              "ip_anonymization" => false,
776
-              "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$",
777
-              "library" => "jquery-1.11.3-trim",
778
-              "project_javascript" => "alert(\"Active Experiment\")"
771
+                "enable_force_variation" => false,
772
+                "exclude_disabled_experiments" => false,
773
+                "exclude_names" => true,
774
+                "include_jquery" => true,
775
+                "ip_anonymization" => false,
776
+                "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$",
777
+                "library" => "jquery-1.11.3-trim",
778
+                "project_javascript" => "alert(\"Active Experiment\")"
779 779
             )
780 780
         ));
781 781
         
@@ -804,22 +804,22 @@  discard block
 block discarded – undo
804 804
         
805 805
         // Create new event in the project
806 806
         $event = new ClickEvent(array(
807
-              "event_filter" => array(
807
+                "event_filter" => array(
808 808
                 "filter_type" => "target_selector",
809 809
                 "selector" => ".menu-options"
810
-              ),
811
-              "name" => "Add to Cart",
812
-              "archived" => true,
813
-              "category" => "add_to_cart",
814
-              "description" => "Some simple event",
815
-              "event_type" => "click",
816
-              "key" => "add_to_cart",
817
-              "created" => "2016-10-18T05:07:04.153Z",
818
-              "id" => 0,
819
-              "is_classic" => false,
820
-              //"is_editable" => true,
821
-              "page_id" => $createdPage->getId(),
822
-              "project_id" => $createdProject->getId()
810
+                ),
811
+                "name" => "Add to Cart",
812
+                "archived" => true,
813
+                "category" => "add_to_cart",
814
+                "description" => "Some simple event",
815
+                "event_type" => "click",
816
+                "key" => "add_to_cart",
817
+                "created" => "2016-10-18T05:07:04.153Z",
818
+                "id" => 0,
819
+                "is_classic" => false,
820
+                //"is_editable" => true,
821
+                "page_id" => $createdPage->getId(),
822
+                "project_id" => $createdProject->getId()
823 823
         ));
824 824
         
825 825
         $result = $optimizelyClient->events()->createClickEvent($createdPage->getId(), $event);
@@ -944,12 +944,12 @@  discard block
 block discarded – undo
944 944
             "holdback" => 5000,
945 945
             "key" => "home_page_experiment",
946 946
             "metrics" => array(
947
-              array(
947
+                array(
948 948
                 "aggregator" => "unique",
949 949
                 "event_id" => $createdEvent->getId(),
950 950
                 "field" => "revenue",
951 951
                 "scope" => "visitor"
952
-              )
952
+                )
953 953
             ),
954 954
             "name" => "Blue Button Experiment",
955 955
             /*"schedule" => array(
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/ChangeAttribute.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
                 case 'style': $this->setStyle($value); break;
78 78
                 case 'text': $this->setText($value); break;
79 79
                 default:
80
-                    throw new Exception('Unknown option found in the ChangeAttribute entity: ' . $name);
80
+                    throw new Exception('Unknown option found in the ChangeAttribute entity: '.$name);
81 81
             }
82 82
         }
83 83
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         // Remove options with empty values
102 102
         $cleanedOptions = array();
103 103
         foreach ($options as $name=>$value) {
104
-            if ($value!==null)
104
+            if ($value !== null)
105 105
                 $cleanedOptions[$name] = $value;
106 106
         }
107 107
         
Please login to merge, or discard this 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/CssAttribute.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
                 case 'position': $this->setPosition($value); break;
55 55
                 case 'width': $this->setWidth($value); break;
56 56
                 default:
57
-                    throw new Exception('Unknown option found in the CssAttribute entity: ' . $name);
57
+                    throw new Exception('Unknown option found in the CssAttribute entity: '.$name);
58 58
             }
59 59
         }
60 60
     }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         // Remove options with empty values
82 82
         $cleanedOptions = array();
83 83
         foreach ($options as $name=>$value) {
84
-            if ($value!==null)
84
+            if ($value !== null)
85 85
                 $cleanedOptions[$name] = $value;
86 86
         }
87 87
         
Please login to merge, or discard this 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/Attribute.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                 case 'id': $this->setId($value); break;
80 80
                 case 'last_modified': $this->setLastModified($value); break;
81 81
                 default:
82
-                    throw new Exception('Unknown option found in the Attribute entity: ' . $name);
82
+                    throw new Exception('Unknown option found in the Attribute entity: '.$name);
83 83
             }
84 84
         }
85 85
     }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         // Remove options with empty values
104 104
         $cleanedOptions = array();
105 105
         foreach ($options as $name=>$value) {
106
-            if ($value!==null)
106
+            if ($value !== null)
107 107
                 $cleanedOptions[$name] = $value;
108 108
         }
109 109
         
Please login to merge, or discard this 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/Service/v2/Experiments.php 2 patches
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
         
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
             throw new Exception("Expected argument of type Experiment");
175 175
         }
176 176
         
177
-        if ($experimentId<0) {
177
+        if ($experimentId < 0) {
178 178
             throw new Exception("Expected positive experiment ID argument");
179 179
         }
180 180
         
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -146,7 +146,9 @@
 block discarded – undo
146 146
         }
147 147
         
148 148
         $queryParams = array();
149
-        if ($action!=null) $queryParams['action'] = $action;
149
+        if ($action!=null) {
150
+            $queryParams['action'] = $action;
151
+        }
150 152
         
151 153
         $postData = $experiment->toArray();
152 154
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Service/v2/Attributes.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@
 block discarded – undo
36 36
      * @return Result
37 37
      * @throws Exception
38 38
      */
39
-    public function listAll($projectId, $page=1, $perPage=25)
39
+    public function listAll($projectId, $page = 1, $perPage = 25)
40 40
     {
41
-        if ($page<0) {
41
+        if ($page < 0) {
42 42
             throw new Exception('Invalid page number passed');
43 43
         }
44 44
         
45
-        if ($perPage<0 || $perPage>100) {
45
+        if ($perPage < 0 || $perPage > 100) {
46 46
             throw new Exception('Invalid page size passed');
47 47
         }
48 48
         
Please login to merge, or discard this patch.