Completed
Push — master ( a99496...5c0b02 )
by Oleg
02:28
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
     }
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
             'last_modified' => $this->getLastModified(),
201 201
             'metrics' => array(),
202 202
             'name' => $this->getName(),
203
-            'schedule' => $this->getSchedule()?$this->getSchedule()->toArray():null,
203
+            'schedule' => $this->getSchedule() ? $this->getSchedule()->toArray() : null,
204 204
             'status' => $this->getStatus(),
205 205
             'variations' => array(),
206 206
             'id' => $this->getId(),
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         // Remove options with empty values
225 225
         $cleanedOptions = array();
226 226
         foreach ($options as $name=>$value) {
227
-            if ($value!==null)
227
+            if ($value !== null)
228 228
                 $cleanedOptions[$name] = $value;
229 229
         }
230 230
         
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   +201 added lines, -201 removed lines patch added patch discarded remove patch
@@ -24,20 +24,20 @@  discard block
 block discarded – undo
24 24
                         array(
25 25
                             "project_id" => 1000,
26 26
                             "audience_ids" => array(
27
-                              1234,
28
-                              1212,
29
-                              1432
27
+                                1234,
28
+                                1212,
29
+                                1432
30 30
                             ),
31 31
                             "campaign_id" => 2000,
32 32
                             "changes" => array(
33
-                              array(
33
+                                array(
34 34
                                 "type" => "custom_code",
35 35
                                 "allow_additional_redirect" => true,
36 36
                                 "async" => true,
37 37
                                 "selector" => "a[href*=\"optimizely\"]",
38 38
                                 "dependencies" => array(
39
-                                  24,
40
-                                  26
39
+                                    24,
40
+                                    26
41 41
                                 ),
42 42
                                 "destination" => "https://app.optimizely.com/",
43 43
                                 "extension_id" => 1234,
@@ -45,39 +45,39 @@  discard block
 block discarded – undo
45 45
                                 "src" => 524,
46 46
                                 "value" => "window.someGlobalFunction();",
47 47
                                 "id" => "string"
48
-                              )
48
+                                )
49 49
                             ),
50 50
                             "description" => "string",
51 51
                             "holdback" => 5000,
52 52
                             "key" => "home_page_experiment",
53 53
                             "metrics" => array(
54
-                              array(
54
+                                array(
55 55
                                 "aggregator" => "unique",
56 56
                                 "event_id" => 0,
57 57
                                 "field" => "revenue",
58 58
                                 "scope" => "session"
59
-                              )
59
+                                )
60 60
                             ),
61 61
                             "name" => "Blue Button Experiment",
62 62
                             "schedule" => array(
63
-                              "start_time" => "2016-10-17T07:05:00.070Z",
64
-                              "stop_time" => "2016-10-17T07:05:00.070Z",
65
-                              "time_zone" => "UTC"
63
+                                "start_time" => "2016-10-17T07:05:00.070Z",
64
+                                "stop_time" => "2016-10-17T07:05:00.070Z",
65
+                                "time_zone" => "UTC"
66 66
                             ),
67 67
                             "status" => "active",
68 68
                             "variations" => array(
69
-                              array(
69
+                                array(
70 70
                                 "actions" => array(
71
-                                  array(
71
+                                    array(
72 72
                                     "changes" => array(
73
-                                      array(
73
+                                        array(
74 74
                                         "type" => "custom_code",
75 75
                                         "allow_additional_redirect" => true, 
76 76
                                         "async" => true,
77 77
                                         "selector" => "a[href*=\"optimizely\"]",
78 78
                                         "dependencies" => array(
79
-                                          24,
80
-                                          26
79
+                                            24,
80
+                                            26
81 81
                                         ),
82 82
                                         "destination" => "https://app.optimizely.com/",
83 83
                                         "extension_id" => 1234,
@@ -85,23 +85,23 @@  discard block
 block discarded – undo
85 85
                                         "src" => 524,
86 86
                                         "value" => "window.someGlobalFunction();",
87 87
                                         "id" => "string"
88
-                                      )
88
+                                        )
89 89
                                     ),
90 90
                                     "page_id" => 0
91
-                                  )
91
+                                    )
92 92
                                 ),
93 93
                                 "archived"=> true,
94 94
                                 "key" => "blue_button_variation",
95 95
                                 "name" => "Blue Button",
96 96
                                 "variation_id" => 0,
97 97
                                 "weight" => 0
98
-                              )
98
+                                )
99 99
                             ),
100 100
                             "created" => "2016-10-17T07:05:00.070Z",
101 101
                             "id" => 3000,
102 102
                             "is_classic" => false,
103 103
                             "last_modified" => "2016-10-17T07:05:00.070Z"
104
-                          )
104
+                            )
105 105
                         ), 200);
106 106
         
107 107
         $optimizelyApiClientMock->method('sendApiRequest')
@@ -172,20 +172,20 @@  discard block
 block discarded – undo
172 172
         $result = new Result(array(
173 173
                             "project_id" => 1000,
174 174
                             "audience_ids" => array(
175
-                              1234,
176
-                              1212,
177
-                              1432
175
+                                1234,
176
+                                1212,
177
+                                1432
178 178
                             ),
179 179
                             "campaign_id" => 2000,
180 180
                             "changes" => array(
181
-                              array(
181
+                                array(
182 182
                                 "type" => "custom_code",
183 183
                                 "allow_additional_redirect" => true,
184 184
                                 "async" => true,
185 185
                                 "selector" => "a[href*=\"optimizely\"]",
186 186
                                 "dependencies" => array(
187
-                                  24,
188
-                                  26
187
+                                    24,
188
+                                    26
189 189
                                 ),
190 190
                                 "destination" => "https://app.optimizely.com/",
191 191
                                 "extension_id" => 1234,
@@ -193,39 +193,39 @@  discard block
 block discarded – undo
193 193
                                 "src" => 524,
194 194
                                 "value" => "window.someGlobalFunction();",
195 195
                                 "id" => "string"
196
-                              )
196
+                                )
197 197
                             ),
198 198
                             "description" => "string",
199 199
                             "holdback" => 5000,
200 200
                             "key" => "home_page_experiment",
201 201
                             "metrics" => array(
202
-                              array(
202
+                                array(
203 203
                                 "aggregator" => "unique",
204 204
                                 "event_id" => 0,
205 205
                                 "field" => "revenue",
206 206
                                 "scope" => "session"
207
-                              )
207
+                                )
208 208
                             ),
209 209
                             "name" => "Blue Button Experiment",
210 210
                             "schedule" => array(
211
-                              "start_time" => "2016-10-17T07:05:00.070Z",
212
-                              "stop_time" => "2016-10-17T07:05:00.070Z",
213
-                              "time_zone" => "UTC"
211
+                                "start_time" => "2016-10-17T07:05:00.070Z",
212
+                                "stop_time" => "2016-10-17T07:05:00.070Z",
213
+                                "time_zone" => "UTC"
214 214
                             ),
215 215
                             "status" => "active",
216 216
                             "variations" => array(
217
-                              array(
217
+                                array(
218 218
                                 "actions" => array(
219
-                                  array(
219
+                                    array(
220 220
                                     "changes" => array(
221
-                                      array(
221
+                                        array(
222 222
                                         "type" => "custom_code",
223 223
                                         "allow_additional_redirect" => true, 
224 224
                                         "async" => true,
225 225
                                         "selector" => "a[href*=\"optimizely\"]",
226 226
                                         "dependencies" => array(
227
-                                          24,
228
-                                          26
227
+                                            24,
228
+                                            26
229 229
                                         ),
230 230
                                         "destination" => "https://app.optimizely.com/",
231 231
                                         "extension_id" => 1234,
@@ -233,23 +233,23 @@  discard block
 block discarded – undo
233 233
                                         "src" => 524,
234 234
                                         "value" => "window.someGlobalFunction();",
235 235
                                         "id" => "string"
236
-                                      )
236
+                                        )
237 237
                                     ),
238 238
                                     "page_id" => 0
239
-                                  )
239
+                                    )
240 240
                                 ),
241 241
                                 "archived"=> true,
242 242
                                 "key" => "blue_button_variation",
243 243
                                 "name" => "Blue Button",
244 244
                                 "variation_id" => 0,
245 245
                                 "weight" => 0
246
-                              )
246
+                                )
247 247
                             ),
248 248
                             "created" => "2016-10-17T07:05:00.070Z",
249 249
                             "id" => 3000,
250 250
                             "is_classic" => false,
251 251
                             "last_modified" => "2016-10-17T07:05:00.070Z"
252
-                          ), 200);
252
+                            ), 200);
253 253
         
254 254
         $optimizelyApiClientMock->method('sendApiRequest')
255 255
                     ->willReturn($result);
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
                             "end_time" => "2016-10-17T07:05:00.089Z",
306 306
                             "experiment_id" => 3000,
307 307
                             "metrics" => array(
308
-                              array(
308
+                                array(
309 309
                                 "event" => "string",
310 310
                                 "event_name" => "string",
311 311
                                 "measure" => "conversions",
@@ -313,54 +313,54 @@  discard block
 block discarded – undo
313 313
                                 "priority" => 1,
314 314
                                 "unit" => "session",
315 315
                                 "variation_results" => array(
316
-                                  "9000" => array(
316
+                                    "9000" => array(
317 317
                                     "experiment_id" => 0,
318 318
                                     "is_baseline" => true,
319 319
                                     "lift" => array(
320
-                                      "confidence_interval" => array(
320
+                                        "confidence_interval" => array(
321 321
                                         0.010399560300730457,
322 322
                                         0.0850821459929161
323
-                                      ),
324
-                                      "is_most_conclusive" => true,
325
-                                      "is_significant" => true,
326
-                                      "significance" => 0,
327
-                                      "value" => 0,
328
-                                      "visitors_remaining" => 0
323
+                                        ),
324
+                                        "is_most_conclusive" => true,
325
+                                        "is_significant" => true,
326
+                                        "significance" => 0,
327
+                                        "value" => 0,
328
+                                        "visitors_remaining" => 0
329 329
                                     ),
330 330
                                     "name" => "Blue Button",
331 331
                                     "rate" => 0,
332 332
                                     "scope" => "variation",
333 333
                                     "total_increase" => array(
334
-                                      "confidence_interval" => array(
334
+                                        "confidence_interval" => array(
335 335
                                         0.010399560300730457,
336 336
                                         0.0850821459929161
337
-                                      ),
338
-                                      "is_most_conclusive" => true,
339
-                                      "is_significant" => true,
340
-                                      "significance" => 0,
341
-                                      "value" => 0,
342
-                                      "visitors_remaining" => 0
337
+                                        ),
338
+                                        "is_most_conclusive" => true,
339
+                                        "is_significant" => true,
340
+                                        "significance" => 0,
341
+                                        "value" => 0,
342
+                                        "visitors_remaining" => 0
343 343
                                     ),
344 344
                                     "value" => 0,
345 345
                                     "variation_id" => "string"
346
-                                  )
346
+                                    )
347
+                                )
347 348
                                 )
348
-                              )
349 349
                             ),
350 350
                             "reach" => array(
351
-                              "baseline_count" => 0,
352
-                              "baseline_reach" => 0,
353
-                              "total_count" => 0,
354
-                              "treatment_count" => 0,
355
-                              "treatment_reach" => 0,
356
-                              "variations" => array(
351
+                                "baseline_count" => 0,
352
+                                "baseline_reach" => 0,
353
+                                "total_count" => 0,
354
+                                "treatment_count" => 0,
355
+                                "treatment_reach" => 0,
356
+                                "variations" => array(
357 357
                                 "9000" => array(
358
-                                  "count" => 0,
359
-                                  "name" => "Blue Button",
360
-                                  "variation_id" => "string",
361
-                                  "variation_reach" => 0
358
+                                    "count" => 0,
359
+                                    "name" => "Blue Button",
360
+                                    "variation_id" => "string",
361
+                                    "variation_reach" => 0
362
+                                )
362 363
                                 )
363
-                              )
364 364
                             ),
365 365
                             "start_time" => "2016-10-17T07:05:00.090Z"
366 366
                         ), 200);
@@ -387,20 +387,20 @@  discard block
 block discarded – undo
387 387
         $result = new Result(array(
388 388
                             "project_id" => 1000,
389 389
                             "audience_ids" => array(
390
-                              1234,
391
-                              1212,
392
-                              1432
390
+                                1234,
391
+                                1212,
392
+                                1432
393 393
                             ),
394 394
                             "campaign_id" => 2000,
395 395
                             "changes" => array(
396
-                              array(
396
+                                array(
397 397
                                 "type" => "custom_code",
398 398
                                 "allow_additional_redirect" => true,
399 399
                                 "async" => true,
400 400
                                 "selector" => "a[href*=\"optimizely\"]",
401 401
                                 "dependencies" => array(
402
-                                  24,
403
-                                  26
402
+                                    24,
403
+                                    26
404 404
                                 ),
405 405
                                 "destination" => "https://app.optimizely.com/",
406 406
                                 "extension_id" => 1234,
@@ -408,39 +408,39 @@  discard block
 block discarded – undo
408 408
                                 "src" => 524,
409 409
                                 "value" => "window.someGlobalFunction();",
410 410
                                 "id" => "string"
411
-                              )
411
+                                )
412 412
                             ),
413 413
                             "description" => "string",
414 414
                             "holdback" => 5000,
415 415
                             "key" => "home_page_experiment",
416 416
                             "metrics" => array(
417
-                              array(
417
+                                array(
418 418
                                 "aggregator" => "unique",
419 419
                                 "event_id" => 0,
420 420
                                 "field" => "revenue",
421 421
                                 "scope" => "session"
422
-                              )
422
+                                )
423 423
                             ),
424 424
                             "name" => "Blue Button Experiment",
425 425
                             "schedule" => array(
426
-                              "start_time" => "2016-10-17T07:05:00.099Z",
427
-                              "stop_time" => "2016-10-17T07:05:00.099Z",
428
-                              "time_zone" => "UTC"
426
+                                "start_time" => "2016-10-17T07:05:00.099Z",
427
+                                "stop_time" => "2016-10-17T07:05:00.099Z",
428
+                                "time_zone" => "UTC"
429 429
                             ),
430 430
                             "status" => "active",
431 431
                             "variations" => array(
432
-                              array(
432
+                                array(
433 433
                                 "actions" => array(
434
-                                  array(
434
+                                    array(
435 435
                                     "changes" => array(
436
-                                      array(
436
+                                        array(
437 437
                                         "type" => "custom_code",
438 438
                                         "allow_additional_redirect" => true,
439 439
                                         "async" => true,
440 440
                                         "selector" => "a[href*=\"optimizely\"]",
441 441
                                         "dependencies" => array(
442
-                                          24,
443
-                                          26
442
+                                            24,
443
+                                            26
444 444
                                         ),
445 445
                                         "destination" => "https://app.optimizely.com/",
446 446
                                         "extension_id" => 1234,
@@ -448,17 +448,17 @@  discard block
 block discarded – undo
448 448
                                         "src" => 524,
449 449
                                         "value" => "window.someGlobalFunction();",
450 450
                                         "id" => "string"
451
-                                      )
451
+                                        )
452 452
                                     ),
453 453
                                     "page_id" => 0
454
-                                  )
454
+                                    )
455 455
                                 ),
456 456
                                 "archived" => true,
457 457
                                 "key" => "blue_button_variation",
458 458
                                 "name" => "Blue Button",
459 459
                                 "variation_id" => 0,
460 460
                                 "weight" => 0
461
-                              )
461
+                                )
462 462
                             ),
463 463
                             "created" => "2016-10-17T07:05:00.099Z",
464 464
                             "id" => 3000,
@@ -474,76 +474,76 @@  discard block
 block discarded – undo
474 474
         $experiment = new Experiment(array(
475 475
             "project_id" => 1000,
476 476
             "audience_ids" => array(
477
-              1234,
478
-              1212,
479
-              1432
477
+                1234,
478
+                1212,
479
+                1432
480 480
             ),
481 481
             "campaign_id" => 2000,
482 482
             "changes" => array(
483
-              array(
483
+                array(
484 484
                 "type" => "custom_code",
485 485
                 "allow_additional_redirect" => true,
486 486
                 "async" => true,
487 487
                 "selector" => "a[href*=\"optimizely\"]",
488 488
                 "dependencies" => array(
489
-                  24,
490
-                  26
489
+                    24,
490
+                    26
491 491
                 ),
492 492
                 "destination" => "https://app.optimizely.com/",
493 493
                 "extension_id" => 1234,
494 494
                 "preserve_parameters" => true,
495 495
                 "src" => 524,
496 496
                 "value" => "window.someGlobalFunction();"
497
-              )
497
+                )
498 498
             ),
499 499
             "description" => "string",
500 500
             "holdback" => 5000,
501 501
             "key" => "home_page_experiment",
502 502
             "metrics" => array(
503
-              array(
503
+                array(
504 504
                 "aggregator" => "unique",
505 505
                 "event_id" => 0,
506 506
                 "field" => "revenue",
507 507
                 "scope" => "session"
508
-              )
508
+                )
509 509
             ),
510 510
             "name" => "Blue Button Experiment",
511 511
             "schedule" => array(
512
-              "start_time" => "2016-10-17T07:04:59.724Z",
513
-              "stop_time" => "2016-10-17T07:04:59.724Z",
514
-              "time_zone" => "UTC"
512
+                "start_time" => "2016-10-17T07:04:59.724Z",
513
+                "stop_time" => "2016-10-17T07:04:59.724Z",
514
+                "time_zone" => "UTC"
515 515
             ),
516 516
             "status" => "active",
517 517
             "variations" => array(
518
-              array(
518
+                array(
519 519
                 "actions" => array(
520
-                  array(
520
+                    array(
521 521
                     "changes" => array(
522
-                      array(
522
+                        array(
523 523
                         "type" => "custom_code",
524 524
                         "allow_additional_redirect" => true,
525 525
                         "async" => true,
526 526
                         "selector" => "a[href*=\"optimizely\"]",
527 527
                         "dependencies" => array(
528
-                          24,
529
-                          26
528
+                            24,
529
+                            26
530 530
                         ),
531 531
                         "destination" => "https://app.optimizely.com/",
532 532
                         "extension_id" => 1234,
533 533
                         "preserve_parameters" => true,
534 534
                         "src" => 524,
535 535
                         "value" => "window.someGlobalFunction();"
536
-                      )
536
+                        )
537 537
                     ),
538 538
                     "page_id" => 0
539
-                  )
539
+                    )
540 540
                 ),
541 541
                 "archived" => true,
542 542
                 "key" => "blue_button_variation",
543 543
                 "name" => "Blue Button",
544 544
                 "variation_id" => 0,
545 545
                 "weight" => 0
546
-              )
546
+                )
547 547
             )
548 548
         ));
549 549
         
@@ -564,20 +564,20 @@  discard block
 block discarded – undo
564 564
         $result = new Result(array(
565 565
                         "project_id" => 1000,
566 566
                         "audience_ids" => array(
567
-                          1234,
568
-                          1212,
569
-                          1432
567
+                            1234,
568
+                            1212,
569
+                            1432
570 570
                         ),
571 571
                         "campaign_id" => 2000,
572 572
                         "changes" => array(
573
-                          array(
573
+                            array(
574 574
                             "type" => "custom_code",
575 575
                             "allow_additional_redirect" => true,
576 576
                             "async" => true,
577 577
                             "selector" => "a[href*=\"optimizely\"]",
578 578
                             "dependencies" => array(
579
-                              24,
580
-                              26
579
+                                24,
580
+                                26
581 581
                             ),
582 582
                             "destination" => "https://app.optimizely.com/",
583 583
                             "extension_id" => 1234,
@@ -585,39 +585,39 @@  discard block
 block discarded – undo
585 585
                             "src" => 524,
586 586
                             "value" => "window.someGlobalFunction();",
587 587
                             "id" => "string"
588
-                          )
588
+                            )
589 589
                         ),
590 590
                         "description" => "string",
591 591
                         "holdback" => 5000,
592 592
                         "key" => "home_page_experiment",
593 593
                         "metrics" => array(
594
-                          array(
594
+                            array(
595 595
                             "aggregator" => "unique",
596 596
                             "event_id" => 0,
597 597
                             "field" => "revenue",
598 598
                             "scope" => "session"
599
-                          )
599
+                            )
600 600
                         ),
601 601
                         "name" => "Blue Button Experiment",
602 602
                         "schedule" => array(
603
-                          "start_time" => "2016-10-17T07:05:00.109Z",
604
-                          "stop_time" => "2016-10-17T07:05:00.109Z",
605
-                          "time_zone" => "UTC"
603
+                            "start_time" => "2016-10-17T07:05:00.109Z",
604
+                            "stop_time" => "2016-10-17T07:05:00.109Z",
605
+                            "time_zone" => "UTC"
606 606
                         ),
607 607
                         "status" => "active",
608 608
                         "variations" => array(
609
-                          array(
609
+                            array(
610 610
                             "actions" => array(
611
-                              array(
611
+                                array(
612 612
                                 "changes" => array(
613
-                                  array(
613
+                                    array(
614 614
                                     "type" => "custom_code",
615 615
                                     "allow_additional_redirect" => true,
616 616
                                     "async" => true,
617 617
                                     "selector" => "a[href*=\"optimizely\"]",
618 618
                                     "dependencies" => array(
619
-                                      24,
620
-                                      26
619
+                                        24,
620
+                                        26
621 621
                                     ),
622 622
                                     "destination" => "https://app.optimizely.com/",
623 623
                                     "extension_id" => 1234,
@@ -625,17 +625,17 @@  discard block
 block discarded – undo
625 625
                                     "src" => 524,
626 626
                                     "value" => "window.someGlobalFunction();",
627 627
                                     "id" => "string"
628
-                                  )
628
+                                    )
629 629
                                 ),
630 630
                                 "page_id" => 0
631
-                              )
631
+                                )
632 632
                             ),
633 633
                             "archived" => true,
634 634
                             "key" => "blue_button_variation",
635 635
                             "name" => "Blue Button",
636 636
                             "variation_id" => 0,
637 637
                             "weight" => 0
638
-                          )
638
+                            )
639 639
                         ),
640 640
                         "created" => "2016-10-17T07:05:00.109Z",
641 641
                         "id" => 3000,
@@ -649,75 +649,75 @@  discard block
 block discarded – undo
649 649
         $experimentsService = new Experiments($optimizelyApiClientMock);
650 650
         
651 651
         $experiment = new Experiment(array(
652
-              "audience_ids" => array(
652
+                "audience_ids" => array(
653 653
                 0
654
-              ),
655
-              "changes" => array(
654
+                ),
655
+                "changes" => array(
656 656
                 array(
657
-                  "type" => "custom_code",
658
-                  "allow_additional_redirect" => true,
659
-                  "async" => true,
660
-                  "selector" => "a[href*=\"optimizely\"]",
661
-                  "dependencies" => array(
657
+                    "type" => "custom_code",
658
+                    "allow_additional_redirect" => true,
659
+                    "async" => true,
660
+                    "selector" => "a[href*=\"optimizely\"]",
661
+                    "dependencies" => array(
662 662
                     24,
663 663
                     26
664
-                  ),
665
-                  "destination" => "https://app.optimizely.com/",
666
-                  "extension_id" => 1234,
667
-                  "preserve_parameters" => true,
668
-                  "src" => 524,
669
-                  "value" => "window.someGlobalFunction();"
664
+                    ),
665
+                    "destination" => "https://app.optimizely.com/",
666
+                    "extension_id" => 1234,
667
+                    "preserve_parameters" => true,
668
+                    "src" => 524,
669
+                    "value" => "window.someGlobalFunction();"
670 670
                 )
671
-              ),
672
-              "description" => "AB Test to see if the Blue Button converts more visitors",
673
-              "holdback" => 0,
674
-              "key" => "home_page_experiment",
675
-              "metrics" => array(
671
+                ),
672
+                "description" => "AB Test to see if the Blue Button converts more visitors",
673
+                "holdback" => 0,
674
+                "key" => "home_page_experiment",
675
+                "metrics" => array(
676 676
                 array(
677
-                  "aggregator" => "unique",
678
-                  "event_id" => 0,
679
-                  "field" => "revenue",
680
-                  "scope" => "session"
677
+                    "aggregator" => "unique",
678
+                    "event_id" => 0,
679
+                    "field" => "revenue",
680
+                    "scope" => "session"
681 681
                 )
682
-              ),
683
-              "name" => "Blue Button Experiment",
684
-              "schedule" => array(
682
+                ),
683
+                "name" => "Blue Button Experiment",
684
+                "schedule" => array(
685 685
                 "start_time" => "2016-10-17T07:04:59.731Z",
686 686
                 "stop_time" => "2016-10-17T07:04:59.731Z",
687 687
                 "time_zone" => "UTC"
688
-              ),
689
-              "status" => "active",
690
-              "variations" => array(
688
+                ),
689
+                "status" => "active",
690
+                "variations" => array(
691 691
                 array(
692
-                  "actions" => array(
692
+                    "actions" => array(
693 693
                     array(
694
-                      "changes" => array(
694
+                        "changes" => array(
695 695
                         array(
696
-                          "type" => "custom_code",
697
-                          "allow_additional_redirect" => true,
698
-                          "async" => true,
699
-                          "selector" => "a[href*=\"optimizely\"]",
700
-                          "dependencies" => array(
696
+                            "type" => "custom_code",
697
+                            "allow_additional_redirect" => true,
698
+                            "async" => true,
699
+                            "selector" => "a[href*=\"optimizely\"]",
700
+                            "dependencies" => array(
701 701
                             24,
702 702
                             26
703
-                          ),
704
-                          "destination" => "https://app.optimizely.com/",
705
-                          "extension_id" => 1234,
706
-                          "preserve_parameters" => true,
707
-                          "src" => 524,
708
-                          "value" => "window.someGlobalFunction();"
703
+                            ),
704
+                            "destination" => "https://app.optimizely.com/",
705
+                            "extension_id" => 1234,
706
+                            "preserve_parameters" => true,
707
+                            "src" => 524,
708
+                            "value" => "window.someGlobalFunction();"
709 709
                         )
710
-                      ),
711
-                      "page_id" => 0
710
+                        ),
711
+                        "page_id" => 0
712 712
                     )
713
-                  ),
714
-                  "archived" => true,
715
-                  "key" => "blue_button_variation",
716
-                  "name" => "Blue Button",
717
-                  "variation_id" => 0,
718
-                  "weight" => 0
713
+                    ),
714
+                    "archived" => true,
715
+                    "key" => "blue_button_variation",
716
+                    "name" => "Blue Button",
717
+                    "variation_id" => 0,
718
+                    "weight" => 0
719
+                )
719 720
                 )
720
-              )
721 721
         ));
722 722
         
723 723
         $result = $experimentsService->update(1000, $experiment, 'start');
@@ -765,14 +765,14 @@  discard block
 block discarded – undo
765 765
             "platform" => "web",
766 766
             "status" => "active",
767 767
             "web_snippet" => array(
768
-              "enable_force_variation" => false,
769
-              "exclude_disabled_experiments" => false,
770
-              "exclude_names" => true,
771
-              "include_jquery" => true,
772
-              "ip_anonymization" => false,
773
-              "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$",
774
-              "library" => "jquery-1.11.3-trim",
775
-              "project_javascript" => "alert(\"Active Experiment\")"
768
+                "enable_force_variation" => false,
769
+                "exclude_disabled_experiments" => false,
770
+                "exclude_names" => true,
771
+                "include_jquery" => true,
772
+                "ip_anonymization" => false,
773
+                "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$",
774
+                "library" => "jquery-1.11.3-trim",
775
+                "project_javascript" => "alert(\"Active Experiment\")"
776 776
             )
777 777
         ));
778 778
         
@@ -783,12 +783,12 @@  discard block
 block discarded – undo
783 783
         $experiment = new Experiment(array(
784 784
             "project_id" => $createdProject->getId(),
785 785
             "variations" => array(
786
-              array(
786
+                array(
787 787
                 "weight" => 0,
788 788
                 "actions" => array(
789
-                  array(
789
+                    array(
790 790
                     "changes" => array(
791
-                      /*array(
791
+                        /*array(
792 792
                         "type" => "attribute",
793 793
                         "allow_additional_redirect" => true,
794 794
                         "async" => true,
@@ -830,17 +830,17 @@  discard block
 block discarded – undo
830 830
                       )*/
831 831
                     ),
832 832
                     "page_id" => 0
833
-                  )
833
+                    )
834 834
                 ),
835 835
                 "archived" => true,
836 836
                 "key" => "blue_button_variation",
837 837
                 "name" => "Blue Button"
838
-              )
838
+                )
839 839
             ),
840 840
             "audience_conditions" => "[\"and\", {\"audience_id\": 7000}, {\"audience_id\":7001}]",
841 841
             //"campaign_id" => 2000,
842 842
             "changes" => array(
843
-              /*array(
843
+                /*array(
844 844
                 "type" => "attribute",
845 845
                 "allow_additional_redirect" => true,
846 846
                 "async" => true,
@@ -885,18 +885,18 @@  discard block
 block discarded – undo
885 885
             "holdback" => 5000,
886 886
             "key" => "home_page_experiment",
887 887
             "metrics" => array(
888
-              array(
888
+                array(
889 889
                 "aggregator" => "unique",
890 890
                 "event_id" => 0,
891 891
                 "field" => "revenue",
892 892
                 "scope" => "session"
893
-              )
893
+                )
894 894
             ),
895 895
             "name" => "Blue Button Experiment",
896 896
             "schedule" => array(
897
-              "start_time" => "string",
898
-              "stop_time" => "string",
899
-              "time_zone" => "GMT-01:00"
897
+                "start_time" => "string",
898
+                "stop_time" => "string",
899
+                "time_zone" => "GMT-01:00"
900 900
             ),
901 901
             "type" => "a/b"    
902 902
         ));
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.