Completed
Push — master ( 8b1dd2...f2d606 )
by Oleg
02:17
created
tests/OptimizelyPHPTest/Service/v2/ExperimentsTest.php 1 patch
Indentation   +232 added lines, -232 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_id" => "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
                                 "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);
@@ -843,15 +843,15 @@  discard block
 block discarded – undo
843 843
             "project_id" => $createdProject->getId(),
844 844
             "variations" => array(
845 845
             array(
846
-              "weight" => 10000,
847
-              "actions" => array(
846
+                "weight" => 10000,
847
+                "actions" => array(
848 848
                 array(
849
-                  "changes" => array(
849
+                    "changes" => array(
850 850
                     array(
851
-                      "type" => "attribute",
852
-                      //"allow_additional_redirect" => true,
853
-                      "async" => true,
854
-                      "attributes" => array(
851
+                        "type" => "attribute",
852
+                        //"allow_additional_redirect" => true,
853
+                        "async" => true,
854
+                        "attributes" => array(
855 855
                         "class" => "intro",
856 856
                         "hide" => true,
857 857
                         "href" => "example.com",
@@ -860,9 +860,9 @@  discard block
 block discarded – undo
860 860
                         "src" => "song.mp3",
861 861
                         "style" => "background-color:blue;",
862 862
                         "text" => "Some nice message"
863
-                      ),
864
-                      //"config" => ["name" => "Flash Sale Today!", "color" => "blue"],
865
-                      "css" => array(
863
+                        ),
864
+                        //"config" => ["name" => "Flash Sale Today!", "color" => "blue"],
865
+                        "css" => array(
866 866
                         "background-color" => "string",
867 867
                         "background-image" => "string",
868 868
                         "border-color" => "string",
@@ -874,38 +874,38 @@  discard block
 block discarded – undo
874 874
                         "height" => "string",
875 875
                         "position" => "string",
876 876
                         "width" => "string"
877
-                      ),
878
-                      /*"dependencies" => [
877
+                        ),
878
+                        /*"dependencies" => [
879 879
                         '24',
880 880
                         '26'
881 881
                       ],*/
882
-                      //"destination" => "https://app.optimizely.com/",
883
-                      "name" => "Setting button text",
884
-                      //"operator" => "after",
885
-                      //"preserve_parameters" => true,
886
-                      "rearrange" => "{\"insertSelector\": \".greyBox\", \"operator\": \"before\"}",
887
-                      "selector" => "a[href*=\"optimizely\"]",
888
-                      //"value" => "window.someGlobalFunction();"
882
+                        //"destination" => "https://app.optimizely.com/",
883
+                        "name" => "Setting button text",
884
+                        //"operator" => "after",
885
+                        //"preserve_parameters" => true,
886
+                        "rearrange" => "{\"insertSelector\": \".greyBox\", \"operator\": \"before\"}",
887
+                        "selector" => "a[href*=\"optimizely\"]",
888
+                        //"value" => "window.someGlobalFunction();"
889 889
                     )
890
-                  ),
891
-                  "page_id" => $createdPage->getId(),
890
+                    ),
891
+                    "page_id" => $createdPage->getId(),
892 892
                 )
893
-              ),
894
-              "archived" => false,
895
-              "key" => "blue_button_variation",
896
-              "name" => "Blue Button"
893
+                ),
894
+                "archived" => false,
895
+                "key" => "blue_button_variation",
896
+                "name" => "Blue Button"
897 897
             )
898
-          ),
898
+            ),
899 899
             "description" => "string",
900 900
             "holdback" => 5000,
901 901
             "key" => "home_page_experiment",
902 902
             "metrics" => array(
903
-              array(
903
+                array(
904 904
                 "aggregator" => "sum",
905 905
                 "event_id" => $createdEvent->getId(),
906 906
                 "field" => "revenue",
907 907
                 "scope" => "visitor"
908
-              )
908
+                )
909 909
             ),
910 910
             "name" => "Blue Button Experiment",
911 911
             /*"schedule" => array(
Please login to merge, or discard this patch.
tests/OptimizelyPHPTest/Resource/v2/ExperimentResultsTest.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
             "end_time" => "2016-10-14T05:08:43.031Z",
14 14
             "experiment_id" => 3000,
15 15
             "metrics" => array(
16
-              array(
16
+                array(
17 17
                 "event_id" => "string",
18 18
                 "event_name" => "string",
19 19
                 "measure" => "conversions",
@@ -21,54 +21,54 @@  discard block
 block discarded – undo
21 21
                 "priority" => 1,
22 22
                 "unit" => "session",
23 23
                 "results" => array(
24
-                  "9000" => array(
24
+                    "9000" => array(
25 25
                     "experiment_id" => 0,
26 26
                     "is_baseline" => true,
27 27
                     "lift" => array(
28
-                      "confidence_interval" => array(
28
+                        "confidence_interval" => array(
29 29
                         0.010399560300730457,
30 30
                         0.0850821459929161
31
-                      ),
32
-                      "is_most_conclusive" => true,
33
-                      "is_significant" => true,
34
-                      "significance" => 0,
35
-                      "value" => 0,
36
-                      "visitors_remaining" => 0
31
+                        ),
32
+                        "is_most_conclusive" => true,
33
+                        "is_significant" => true,
34
+                        "significance" => 0,
35
+                        "value" => 0,
36
+                        "visitors_remaining" => 0
37 37
                     ),
38 38
                     "name" => "Blue Button",
39 39
                     "rate" => 0,
40 40
                     "scope" => "variation",
41 41
                     "total_increase" => array(
42
-                      "confidence_interval" => array(
42
+                        "confidence_interval" => array(
43 43
                         0.010399560300730457,
44 44
                         0.0850821459929161
45
-                      ),
46
-                      "is_most_conclusive" => true,
47
-                      "is_significant" => true,
48
-                      "significance" => 0,
49
-                      "value" => 0,
50
-                      "visitors_remaining" => 0
45
+                        ),
46
+                        "is_most_conclusive" => true,
47
+                        "is_significant" => true,
48
+                        "significance" => 0,
49
+                        "value" => 0,
50
+                        "visitors_remaining" => 0
51 51
                     ),
52 52
                     "value" => 0,
53 53
                     "variation_id" => "string"
54
-                  )
54
+                    )
55
+                )
55 56
                 )
56
-              )
57 57
             ),
58 58
             "reach" => array(
59
-              "baseline_count" => 0,
60
-              "baseline_reach" => 0,
61
-              "total_count" => 0,
62
-              "treatment_count" => 0,
63
-              "treatment_reach" => 0,
64
-              "variations" => array(
59
+                "baseline_count" => 0,
60
+                "baseline_reach" => 0,
61
+                "total_count" => 0,
62
+                "treatment_count" => 0,
63
+                "treatment_reach" => 0,
64
+                "variations" => array(
65 65
                 "9000" => array(
66
-                  "count" => 0,
67
-                  "name" => "Blue Button",
68
-                  "variation_id" => "string",
69
-                  "variation_reach" => 0
66
+                    "count" => 0,
67
+                    "name" => "Blue Button",
68
+                    "variation_id" => "string",
69
+                    "variation_reach" => 0
70
+                )
70 71
                 )
71
-              )
72 72
             ),
73 73
             "start_time" => "2016-10-14T05:08:43.032Z"
74 74
         );
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
             "end_time" => "2016-10-14T05:08:43.031Z",
87 87
             "experiment_id" => 3000,
88 88
             "metrics" => array(
89
-              array(
89
+                array(
90 90
                 "event_id" => "string",
91 91
                 "event_name" => "string",
92 92
                 "measure" => "conversions",
@@ -94,54 +94,54 @@  discard block
 block discarded – undo
94 94
                 "priority" => 1,
95 95
                 "unit" => "session",
96 96
                 "results" => array(
97
-                  "9000" => array(
97
+                    "9000" => array(
98 98
                     "experiment_id" => 0,
99 99
                     "is_baseline" => true,
100 100
                     "lift" => array(
101
-                      "confidence_interval" => array(
101
+                        "confidence_interval" => array(
102 102
                         0.010399560300730457,
103 103
                         0.0850821459929161
104
-                      ),
105
-                      "is_most_conclusive" => true,
106
-                      "is_significant" => true,
107
-                      "significance" => 0,
108
-                      "value" => 0,
109
-                      "visitors_remaining" => 0
104
+                        ),
105
+                        "is_most_conclusive" => true,
106
+                        "is_significant" => true,
107
+                        "significance" => 0,
108
+                        "value" => 0,
109
+                        "visitors_remaining" => 0
110 110
                     ),
111 111
                     "name" => "Blue Button",
112 112
                     "rate" => 0,
113 113
                     "scope" => "variation",
114 114
                     "total_increase" => array(
115
-                      "confidence_interval" => array(
115
+                        "confidence_interval" => array(
116 116
                         0.010399560300730457,
117 117
                         0.0850821459929161
118
-                      ),
119
-                      "is_most_conclusive" => true,
120
-                      "is_significant" => true,
121
-                      "significance" => 0,
122
-                      "value" => 0,
123
-                      "visitors_remaining" => 0
118
+                        ),
119
+                        "is_most_conclusive" => true,
120
+                        "is_significant" => true,
121
+                        "significance" => 0,
122
+                        "value" => 0,
123
+                        "visitors_remaining" => 0
124 124
                     ),
125 125
                     "value" => 0,
126 126
                     "variation_id" => "string"
127
-                  )
127
+                    )
128
+                )
128 129
                 )
129
-              )
130 130
             ),
131 131
             "reach" => array(
132
-              "baseline_count" => 0,
133
-              "baseline_reach" => 0,
134
-              "total_count" => 0,
135
-              "treatment_count" => 0,
136
-              "treatment_reach" => 0,
137
-              "variations" => array(
132
+                "baseline_count" => 0,
133
+                "baseline_reach" => 0,
134
+                "total_count" => 0,
135
+                "treatment_count" => 0,
136
+                "treatment_reach" => 0,
137
+                "variations" => array(
138 138
                 "9000" => array(
139
-                  "count" => 0,
140
-                  "name" => "Blue Button",
141
-                  "variation_id" => "string",
142
-                  "variation_reach" => 0
139
+                    "count" => 0,
140
+                    "name" => "Blue Button",
141
+                    "variation_id" => "string",
142
+                    "variation_reach" => 0
143
+                )
143 144
                 )
144
-              )
145 145
             ),
146 146
             "start_time" => "2016-10-14T05:08:43.032Z"
147 147
         );
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/ExperimentMetricResults.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                 case 'scope': $this->setScope($value); break;
129 129
                 case 'winning_direction': $this->setWinningDirection($value); break;
130 130
                 default:
131
-                    throw new Exception('Unknown option found in the ExperimentMetricResults entity: ' . $name);
131
+                    throw new Exception('Unknown option found in the ExperimentMetricResults entity: '.$name);
132 132
             }
133 133
         }
134 134
     }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         // Remove options with empty values
161 161
         $cleanedOptions = array();
162 162
         foreach ($options as $name=>$value) {
163
-            if ($value!==null)
163
+            if ($value !== null)
164 164
                 $cleanedOptions[$name] = $value;
165 165
         }
166 166
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/ExperimentResults.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                 case 'start_time': $this->setStartTime($value); break;
84 84
                 case 'stats_config': $this->setStatsConfig(new StatsConfig($value)); break;
85 85
                 default:
86
-                    throw new Exception('Unknown option found in the ExperimentResults entity: ' . $name);
86
+                    throw new Exception('Unknown option found in the ExperimentResults entity: '.$name);
87 87
             }
88 88
         }
89 89
     }
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
             'end_time' => $this->getEndTime(),
99 99
             'experiment_id' => $this->getExperimentId(),
100 100
             'metrics' => array(),
101
-            'reach' => $this->getReach()?$this->getReach()->toArray():null,
101
+            'reach' => $this->getReach() ? $this->getReach()->toArray() : null,
102 102
             'start_time' => $this->getStartTime(),
103
-            'stats_config' => $this->getStatsConfig()?$this->getStatsConfig()->toArray():null,
103
+            'stats_config' => $this->getStatsConfig() ? $this->getStatsConfig()->toArray() : null,
104 104
         );
105 105
         
106 106
         foreach ($this->getMetrics() as $metric) {
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         // Remove options with empty values
111 111
         $cleanedOptions = array();
112 112
         foreach ($options as $name=>$value) {
113
-            if ($value!==null)
113
+            if ($value !== null)
114 114
                 $cleanedOptions[$name] = $value;
115 115
         }
116 116
         
Please login to merge, or discard this patch.