@@ -91,8 +91,9 @@ |
||
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; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | case 'code_revision': $this->setCodeRevision($value); break; |
99 | 99 | case 'js_file_size': $this->setJsFileSize($value); break; |
100 | 100 | default: |
101 | - throw new Exception('Unknown option found in WebSnippet entity: ' . $name); |
|
101 | + throw new Exception('Unknown option found in WebSnippet entity: '.$name); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | // Remove options with empty values |
125 | 125 | $cleanedOptions = array(); |
126 | 126 | foreach ($options as $name=>$value) { |
127 | - if ($value!==null) |
|
127 | + if ($value !== null) |
|
128 | 128 | $cleanedOptions[$name] = $value; |
129 | 129 | } |
130 | 130 |
@@ -1,7 +1,6 @@ |
||
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; |
@@ -465,8 +465,9 @@ |
||
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 |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | array( |
26 | 26 | "project_id" => 1000, |
27 | 27 | "changes" => array( |
28 | - array( |
|
28 | + array( |
|
29 | 29 | "type" => "custom_code", |
30 | 30 | "allow_additional_redirect" => true, |
31 | 31 | "async" => true, |
32 | 32 | "selector" => "a[href*=\"optimizely\"]", |
33 | 33 | "dependencies" => array( |
34 | - 24, |
|
35 | - 26 |
|
34 | + 24, |
|
35 | + 26 |
|
36 | 36 | ), |
37 | 37 | "destination" => "https://app.optimizely.com/", |
38 | 38 | "extension_id" => 1234, |
@@ -40,32 +40,32 @@ discard block |
||
40 | 40 | "src" => 524, |
41 | 41 | "value" => "window.someGlobalFunction();", |
42 | 42 | "id" => "string" |
43 | - ) |
|
43 | + ) |
|
44 | 44 | ), |
45 | 45 | "created" => "2016-10-18T03:27:04.123Z", |
46 | 46 | "earliest" => "2016-10-18T03:27:04.123Z", |
47 | 47 | "experiment_ids" => array( |
48 | - 0 |
|
48 | + 0 |
|
49 | 49 | ), |
50 | 50 | "holdback" => 0, |
51 | 51 | "last_modified" => "2016-10-18T03:27:04.123Z", |
52 | 52 | "latest" => "2016-10-18T03:27:04.123Z", |
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" => "Landing Page Optimization", |
62 | 62 | "page_ids" => array( |
63 | - 0 |
|
63 | + 0 |
|
64 | 64 | ), |
65 | 65 | "status" => "active", |
66 | 66 | "type" => "a/b", |
67 | 67 | "id" => 2000 |
68 | - ) |
|
68 | + ) |
|
69 | 69 | ), 200); |
70 | 70 | |
71 | 71 | $optimizelyApiClientMock->method('sendApiRequest') |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | $result = new Result(array( |
122 | 122 | "project_id" => 1000, |
123 | 123 | "changes" => array( |
124 | - array( |
|
124 | + array( |
|
125 | 125 | "type" => "custom_code", |
126 | 126 | "allow_additional_redirect" => true, |
127 | 127 | "async" => true, |
128 | 128 | "selector" => "a[href*=\"optimizely\"]", |
129 | 129 | "dependencies" => array( |
130 | - 24, |
|
131 | - 26 |
|
130 | + 24, |
|
131 | + 26 |
|
132 | 132 | ), |
133 | 133 | "destination" => "https://app.optimizely.com/", |
134 | 134 | "extension_id" => 1234, |
@@ -136,27 +136,27 @@ discard block |
||
136 | 136 | "src" => 524, |
137 | 137 | "value" => "window.someGlobalFunction();", |
138 | 138 | "id" => "string" |
139 | - ) |
|
139 | + ) |
|
140 | 140 | ), |
141 | 141 | "created" => "2016-10-18T03:27:04.139Z", |
142 | 142 | "earliest" => "2016-10-18T03:27:04.139Z", |
143 | 143 | "experiment_ids" => array( |
144 | - 0 |
|
144 | + 0 |
|
145 | 145 | ), |
146 | 146 | "holdback" => 0, |
147 | 147 | "last_modified" => "2016-10-18T03:27:04.139Z", |
148 | 148 | "latest" => "2016-10-18T03:27:04.139Z", |
149 | 149 | "metrics" => array( |
150 | - array( |
|
150 | + array( |
|
151 | 151 | "aggregator" => "unique", |
152 | 152 | "event_id" => 0, |
153 | 153 | "field" => "revenue", |
154 | 154 | "scope" => "session" |
155 | - ) |
|
155 | + ) |
|
156 | 156 | ), |
157 | 157 | "name" => "Landing Page Optimization", |
158 | 158 | "page_ids" => array( |
159 | - 0 |
|
159 | + 0 |
|
160 | 160 | ), |
161 | 161 | "status" => "active", |
162 | 162 | "type" => "a/b", |
@@ -187,47 +187,47 @@ discard block |
||
187 | 187 | "confidence_threshold" => 0, |
188 | 188 | "end_time" => "2016-10-18T03:27:04.147Z", |
189 | 189 | "metrics" => array( |
190 | - array( |
|
190 | + array( |
|
191 | 191 | "event" => "string", |
192 | 192 | "event_name" => "string", |
193 | 193 | "measure" => "conversions", |
194 | 194 | "metric_id" => "string", |
195 | 195 | "priority" => 0, |
196 | 196 | "results" => array( |
197 | - "campaign" => array( |
|
197 | + "campaign" => array( |
|
198 | 198 | "experiment_id" => 0, |
199 | 199 | "is_baseline" => true, |
200 | 200 | "lift" => array( |
201 | - "confidence_interval" => array( |
|
201 | + "confidence_interval" => array( |
|
202 | 202 | 0.010399560300730457, |
203 | 203 | 0.0850821459929161 |
204 | - ), |
|
205 | - "is_most_conclusive" => true, |
|
206 | - "is_significant" => true, |
|
207 | - "significance" => 0, |
|
208 | - "value" => 0, |
|
209 | - "visitors_remaining" => 0 |
|
204 | + ), |
|
205 | + "is_most_conclusive" => true, |
|
206 | + "is_significant" => true, |
|
207 | + "significance" => 0, |
|
208 | + "value" => 0, |
|
209 | + "visitors_remaining" => 0 |
|
210 | 210 | ), |
211 | 211 | "name" => "Blue Button", |
212 | 212 | "rate" => 0, |
213 | 213 | "scope" => "variation", |
214 | 214 | "total_increase" => array( |
215 | - "confidence_interval" => array( |
|
215 | + "confidence_interval" => array( |
|
216 | 216 | 0.010399560300730457, |
217 | 217 | 0.0850821459929161 |
218 | - ), |
|
219 | - "is_most_conclusive" => true, |
|
220 | - "is_significant" => true, |
|
221 | - "significance" => 0, |
|
222 | - "value" => 0, |
|
223 | - "visitors_remaining" => 0 |
|
218 | + ), |
|
219 | + "is_most_conclusive" => true, |
|
220 | + "is_significant" => true, |
|
221 | + "significance" => 0, |
|
222 | + "value" => 0, |
|
223 | + "visitors_remaining" => 0 |
|
224 | 224 | ), |
225 | 225 | "value" => 0, |
226 | 226 | "variation_id" => "string" |
227 | - ) |
|
227 | + ) |
|
228 | 228 | ), |
229 | 229 | "unit" => "session" |
230 | - ) |
|
230 | + ) |
|
231 | 231 | ), |
232 | 232 | "start_time" => "2016-10-18T03:27:04.148Z" |
233 | 233 | ), 200); |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | $result = new Result(array( |
256 | 256 | "project_id" => 1000, |
257 | 257 | "changes" => array( |
258 | - array( |
|
258 | + array( |
|
259 | 259 | "type" => "custom_code", |
260 | 260 | "allow_additional_redirect" => true, |
261 | 261 | "async" => true, |
262 | 262 | "selector" => "a[href*=\"optimizely\"]", |
263 | 263 | "dependencies" => array( |
264 | - 24, |
|
265 | - 26 |
|
264 | + 24, |
|
265 | + 26 |
|
266 | 266 | ), |
267 | 267 | "destination" => "https://app.optimizely.com/", |
268 | 268 | "extension_id" => 1234, |
@@ -270,27 +270,27 @@ discard block |
||
270 | 270 | "src" => 524, |
271 | 271 | "value" => "window.someGlobalFunction();", |
272 | 272 | "id" => "string" |
273 | - ) |
|
273 | + ) |
|
274 | 274 | ), |
275 | 275 | "created" => "2016-10-18T03:27:04.155Z", |
276 | 276 | "earliest" => "2016-10-18T03:27:04.155Z", |
277 | 277 | "experiment_ids" => array( |
278 | - 0 |
|
278 | + 0 |
|
279 | 279 | ), |
280 | 280 | "holdback" => 0, |
281 | 281 | "last_modified" => "2016-10-18T03:27:04.155Z", |
282 | 282 | "latest" => "2016-10-18T03:27:04.155Z", |
283 | 283 | "metrics" => array( |
284 | - array( |
|
284 | + array( |
|
285 | 285 | "aggregator" => "unique", |
286 | 286 | "event_id" => 0, |
287 | 287 | "field" => "revenue", |
288 | 288 | "scope" => "session" |
289 | - ) |
|
289 | + ) |
|
290 | 290 | ), |
291 | 291 | "name" => "Landing Page Optimization", |
292 | 292 | "page_ids" => array( |
293 | - 0 |
|
293 | + 0 |
|
294 | 294 | ), |
295 | 295 | "status" => "active", |
296 | 296 | "type" => "a/b", |
@@ -305,41 +305,41 @@ discard block |
||
305 | 305 | $campaign = new Campaign(array( |
306 | 306 | "project_id" => 1000, |
307 | 307 | "changes" => array( |
308 | - array( |
|
308 | + array( |
|
309 | 309 | "type" => "custom_code", |
310 | 310 | "allow_additional_redirect" => true, |
311 | 311 | "async" => true, |
312 | 312 | "selector" => "a[href*=\"optimizely\"]", |
313 | 313 | "dependencies" => array( |
314 | - 24, |
|
315 | - 26 |
|
314 | + 24, |
|
315 | + 26 |
|
316 | 316 | ), |
317 | 317 | "destination" => "https://app.optimizely.com/", |
318 | 318 | "extension_id" => 1234, |
319 | 319 | "preserve_parameters" => true, |
320 | 320 | "src" => 524, |
321 | 321 | "value" => "window.someGlobalFunction();" |
322 | - ) |
|
322 | + ) |
|
323 | 323 | ), |
324 | 324 | "created" => "2016-10-18T03:27:04.067Z", |
325 | 325 | "earliest" => "2016-10-18T03:27:04.067Z", |
326 | 326 | "experiment_ids" => array( |
327 | - 0 |
|
327 | + 0 |
|
328 | 328 | ), |
329 | 329 | "holdback" => 0, |
330 | 330 | "last_modified" => "2016-10-18T03:27:04.067Z", |
331 | 331 | "latest" => "2016-10-18T03:27:04.067Z", |
332 | 332 | "metrics" => array( |
333 | - array( |
|
333 | + array( |
|
334 | 334 | "aggregator" => "unique", |
335 | 335 | "event_id" => 0, |
336 | 336 | "field" => "revenue", |
337 | 337 | "scope" => "session" |
338 | - ) |
|
338 | + ) |
|
339 | 339 | ), |
340 | 340 | "name" => "Landing Page Optimization", |
341 | 341 | "page_ids" => array( |
342 | - 0 |
|
342 | + 0 |
|
343 | 343 | ), |
344 | 344 | "status" => "active", |
345 | 345 | "type" => "a/b" |
@@ -362,14 +362,14 @@ discard block |
||
362 | 362 | $result = new Result(array( |
363 | 363 | "project_id" => 1000, |
364 | 364 | "changes" => array( |
365 | - array( |
|
365 | + array( |
|
366 | 366 | "type" => "custom_code", |
367 | 367 | "allow_additional_redirect" => true, |
368 | 368 | "async" => true, |
369 | 369 | "selector" => "a[href*=\"optimizely\"]", |
370 | 370 | "dependencies" => array( |
371 | - 24, |
|
372 | - 26 |
|
371 | + 24, |
|
372 | + 26 |
|
373 | 373 | ), |
374 | 374 | "destination" => "https://app.optimizely.com/", |
375 | 375 | "extension_id" => 1234, |
@@ -377,27 +377,27 @@ discard block |
||
377 | 377 | "src" => 524, |
378 | 378 | "value" => "window.someGlobalFunction();", |
379 | 379 | "id" => "string" |
380 | - ) |
|
380 | + ) |
|
381 | 381 | ), |
382 | 382 | "created" => "2016-10-18T03:27:04.155Z", |
383 | 383 | "earliest" => "2016-10-18T03:27:04.155Z", |
384 | 384 | "experiment_ids" => array( |
385 | - 0 |
|
385 | + 0 |
|
386 | 386 | ), |
387 | 387 | "holdback" => 0, |
388 | 388 | "last_modified" => "2016-10-18T03:27:04.155Z", |
389 | 389 | "latest" => "2016-10-18T03:27:04.155Z", |
390 | 390 | "metrics" => array( |
391 | - array( |
|
391 | + array( |
|
392 | 392 | "aggregator" => "unique", |
393 | 393 | "event_id" => 0, |
394 | 394 | "field" => "revenue", |
395 | 395 | "scope" => "session" |
396 | - ) |
|
396 | + ) |
|
397 | 397 | ), |
398 | 398 | "name" => "Landing Page Optimization", |
399 | 399 | "page_ids" => array( |
400 | - 0 |
|
400 | + 0 |
|
401 | 401 | ), |
402 | 402 | "status" => "active", |
403 | 403 | "type" => "a/b", |
@@ -412,41 +412,41 @@ discard block |
||
412 | 412 | $campaign = new Campaign(array( |
413 | 413 | "project_id" => 1000, |
414 | 414 | "changes" => array( |
415 | - array( |
|
415 | + array( |
|
416 | 416 | "type" => "custom_code", |
417 | 417 | "allow_additional_redirect" => true, |
418 | 418 | "async" => true, |
419 | 419 | "selector" => "a[href*=\"optimizely\"]", |
420 | 420 | "dependencies" => array( |
421 | - 24, |
|
422 | - 26 |
|
421 | + 24, |
|
422 | + 26 |
|
423 | 423 | ), |
424 | 424 | "destination" => "https://app.optimizely.com/", |
425 | 425 | "extension_id" => 1234, |
426 | 426 | "preserve_parameters" => true, |
427 | 427 | "src" => 524, |
428 | 428 | "value" => "window.someGlobalFunction();" |
429 | - ) |
|
429 | + ) |
|
430 | 430 | ), |
431 | 431 | "created" => "2016-10-18T03:27:04.067Z", |
432 | 432 | "earliest" => "2016-10-18T03:27:04.067Z", |
433 | 433 | "experiment_ids" => array( |
434 | - 0 |
|
434 | + 0 |
|
435 | 435 | ), |
436 | 436 | "holdback" => 0, |
437 | 437 | "last_modified" => "2016-10-18T03:27:04.067Z", |
438 | 438 | "latest" => "2016-10-18T03:27:04.067Z", |
439 | 439 | "metrics" => array( |
440 | - array( |
|
440 | + array( |
|
441 | 441 | "aggregator" => "unique", |
442 | 442 | "event_id" => 0, |
443 | 443 | "field" => "revenue", |
444 | 444 | "scope" => "session" |
445 | - ) |
|
445 | + ) |
|
446 | 446 | ), |
447 | 447 | "name" => "Landing Page Optimization", |
448 | 448 | "page_ids" => array( |
449 | - 0 |
|
449 | + 0 |
|
450 | 450 | ), |
451 | 451 | "status" => "active", |
452 | 452 | "type" => "a/b" |
@@ -498,14 +498,14 @@ discard block |
||
498 | 498 | "platform" => "web", |
499 | 499 | "status" => "active", |
500 | 500 | "web_snippet" => array( |
501 | - "enable_force_variation" => false, |
|
502 | - "exclude_disabled_experiments" => false, |
|
503 | - "exclude_names" => true, |
|
504 | - "include_jquery" => true, |
|
505 | - "ip_anonymization" => false, |
|
506 | - "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
507 | - "library" => "jquery-1.11.3-trim", |
|
508 | - "project_javascript" => "alert(\"Active Experiment\")" |
|
501 | + "enable_force_variation" => false, |
|
502 | + "exclude_disabled_experiments" => false, |
|
503 | + "exclude_names" => true, |
|
504 | + "include_jquery" => true, |
|
505 | + "ip_anonymization" => false, |
|
506 | + "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
507 | + "library" => "jquery-1.11.3-trim", |
|
508 | + "project_javascript" => "alert(\"Active Experiment\")" |
|
509 | 509 | ) |
510 | 510 | )); |
511 | 511 | |
@@ -539,30 +539,30 @@ discard block |
||
539 | 539 | $campaign = new Campaign(array( |
540 | 540 | "project_id" => $createdProject->getId(), |
541 | 541 | "changes" => array( |
542 | - array( |
|
542 | + array( |
|
543 | 543 | "type" => "custom_code", |
544 | 544 | "value" => "window.someGlobalFunction();" |
545 | - ) |
|
545 | + ) |
|
546 | 546 | ), |
547 | 547 | "created" => "2016-10-18T03:27:04.067Z", |
548 | 548 | "earliest" => "2016-10-18T03:27:04.067Z", |
549 | 549 | "experiment_ids" => array( |
550 | - 0 |
|
550 | + 0 |
|
551 | 551 | ), |
552 | 552 | "holdback" => 0, |
553 | 553 | "last_modified" => "2016-10-18T03:27:04.067Z", |
554 | 554 | "latest" => "2016-10-18T03:27:04.067Z", |
555 | 555 | "metrics" => array( |
556 | - array( |
|
556 | + array( |
|
557 | 557 | "aggregator" => "sum", |
558 | 558 | "event_id" => 0, |
559 | 559 | "field" => "revenue", |
560 | 560 | "scope" => "session" |
561 | - ) |
|
561 | + ) |
|
562 | 562 | ), |
563 | 563 | "name" => "Landing Page Optimization", |
564 | 564 | "page_ids" => array( |
565 | - $createdPage->getId(), |
|
565 | + $createdPage->getId(), |
|
566 | 566 | ), |
567 | 567 | "status" => "not_started", |
568 | 568 | "type" => "a/b" |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | $result = $campaignsService->listAll(1000); |
77 | 77 | $campaigns = $result->getPayload(); |
78 | 78 | |
79 | - $this->assertTrue(count($campaigns)==1); |
|
79 | + $this->assertTrue(count($campaigns) == 1); |
|
80 | 80 | $this->assertTrue($campaigns[0] instanceOf Campaign); |
81 | - $this->assertTrue($campaigns[0]->getName()=='Landing Page Optimization'); |
|
81 | + $this->assertTrue($campaigns[0]->getName() == 'Landing Page Optimization'); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $campaign = $result->getPayload(); |
173 | 173 | |
174 | 174 | $this->assertTrue($campaign instanceOf Campaign); |
175 | - $this->assertTrue($campaign->getName()=='Landing Page Optimization'); |
|
175 | + $this->assertTrue($campaign->getName() == 'Landing Page Optimization'); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | public function testGetResults() |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | $campaignResults = $result->getPayload(); |
242 | 242 | |
243 | 243 | $this->assertTrue($campaignResults instanceOf CampaignResults); |
244 | - $this->assertTrue($campaignResults->getConfidenceThreshold()==0); |
|
245 | - $this->assertTrue($campaignResults->getStartTime()=="2016-10-18T03:27:04.148Z"); |
|
244 | + $this->assertTrue($campaignResults->getConfidenceThreshold() == 0); |
|
245 | + $this->assertTrue($campaignResults->getStartTime() == "2016-10-18T03:27:04.148Z"); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | public function testCreate() |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | $createdCampaign = $result->getPayload(); |
350 | 350 | |
351 | 351 | $this->assertTrue($createdCampaign instanceOf Campaign); |
352 | - $this->assertTrue($createdCampaign->getName()=='Landing Page Optimization'); |
|
352 | + $this->assertTrue($createdCampaign->getName() == 'Landing Page Optimization'); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | public function testUpdate() |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | $updatedCampaign = $result->getPayload(); |
457 | 457 | |
458 | 458 | $this->assertTrue($updatedCampaign instanceOf Campaign); |
459 | - $this->assertTrue($updatedCampaign->getName()=='Landing Page Optimization'); |
|
459 | + $this->assertTrue($updatedCampaign->getName() == 'Landing Page Optimization'); |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | public function testDelete() |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | $credentials = $this->loadCredentialsFromFile(); |
488 | 488 | |
489 | 489 | $optimizelyClient = new OptimizelyApiClient($credentials, 'v2'); |
490 | - $this->assertTrue($optimizelyClient!=null); |
|
490 | + $this->assertTrue($optimizelyClient != null); |
|
491 | 491 | |
492 | 492 | // Create new project |
493 | 493 | $curDate = date('Y-m-d H:i:s'); |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | $createdPage = $result->getPayload(); |
534 | 534 | |
535 | 535 | $this->assertTrue($createdPage instanceOf Page); |
536 | - $this->assertTrue($createdPage->getName()=='Home Page'); |
|
536 | + $this->assertTrue($createdPage->getName() == 'Home Page'); |
|
537 | 537 | |
538 | 538 | // Create new campaign in the project |
539 | 539 | $campaign = new Campaign(array( |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | $createdCampaign = $result->getPayload(); |
573 | 573 | |
574 | 574 | $this->assertTrue($createdCampaign instanceOf Campaign); |
575 | - $this->assertTrue($createdCampaign->getName()=='Landing Page Optimization'); |
|
575 | + $this->assertTrue($createdCampaign->getName() == 'Landing Page Optimization'); |
|
576 | 576 | |
577 | 577 | // Update campaign |
578 | 578 | $createdCampaign->setName('Some new campaign name'); |
@@ -1,7 +1,6 @@ |
||
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; |
@@ -112,9 +112,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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()); |
@@ -238,8 +238,9 @@ discard block |
||
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 |
||
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(); |
@@ -27,20 +27,20 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
308 | 308 | "end_time" => "2016-10-17T07:05:00.089Z", |
309 | 309 | "experiment_id" => 3000, |
310 | 310 | "metrics" => array( |
311 | - array( |
|
311 | + array( |
|
312 | 312 | "event" => "string", |
313 | 313 | "event_name" => "string", |
314 | 314 | "measure" => "conversions", |
@@ -316,54 +316,54 @@ discard block |
||
316 | 316 | "priority" => 1, |
317 | 317 | "unit" => "session", |
318 | 318 | "variation_results" => array( |
319 | - "9000" => array( |
|
319 | + "9000" => array( |
|
320 | 320 | "experiment_id" => 0, |
321 | 321 | "is_baseline" => true, |
322 | 322 | "lift" => array( |
323 | - "confidence_interval" => array( |
|
323 | + "confidence_interval" => array( |
|
324 | 324 | 0.010399560300730457, |
325 | 325 | 0.0850821459929161 |
326 | - ), |
|
327 | - "is_most_conclusive" => true, |
|
328 | - "is_significant" => true, |
|
329 | - "significance" => 0, |
|
330 | - "value" => 0, |
|
331 | - "visitors_remaining" => 0 |
|
326 | + ), |
|
327 | + "is_most_conclusive" => true, |
|
328 | + "is_significant" => true, |
|
329 | + "significance" => 0, |
|
330 | + "value" => 0, |
|
331 | + "visitors_remaining" => 0 |
|
332 | 332 | ), |
333 | 333 | "name" => "Blue Button", |
334 | 334 | "rate" => 0, |
335 | 335 | "scope" => "variation", |
336 | 336 | "total_increase" => array( |
337 | - "confidence_interval" => array( |
|
337 | + "confidence_interval" => array( |
|
338 | 338 | 0.010399560300730457, |
339 | 339 | 0.0850821459929161 |
340 | - ), |
|
341 | - "is_most_conclusive" => true, |
|
342 | - "is_significant" => true, |
|
343 | - "significance" => 0, |
|
344 | - "value" => 0, |
|
345 | - "visitors_remaining" => 0 |
|
340 | + ), |
|
341 | + "is_most_conclusive" => true, |
|
342 | + "is_significant" => true, |
|
343 | + "significance" => 0, |
|
344 | + "value" => 0, |
|
345 | + "visitors_remaining" => 0 |
|
346 | 346 | ), |
347 | 347 | "value" => 0, |
348 | 348 | "variation_id" => "string" |
349 | - ) |
|
349 | + ) |
|
350 | + ) |
|
350 | 351 | ) |
351 | - ) |
|
352 | 352 | ), |
353 | 353 | "reach" => array( |
354 | - "baseline_count" => 0, |
|
355 | - "baseline_reach" => 0, |
|
356 | - "total_count" => 0, |
|
357 | - "treatment_count" => 0, |
|
358 | - "treatment_reach" => 0, |
|
359 | - "variations" => array( |
|
354 | + "baseline_count" => 0, |
|
355 | + "baseline_reach" => 0, |
|
356 | + "total_count" => 0, |
|
357 | + "treatment_count" => 0, |
|
358 | + "treatment_reach" => 0, |
|
359 | + "variations" => array( |
|
360 | 360 | "9000" => array( |
361 | - "count" => 0, |
|
362 | - "name" => "Blue Button", |
|
363 | - "variation_id" => "string", |
|
364 | - "variation_reach" => 0 |
|
361 | + "count" => 0, |
|
362 | + "name" => "Blue Button", |
|
363 | + "variation_id" => "string", |
|
364 | + "variation_reach" => 0 |
|
365 | + ) |
|
365 | 366 | ) |
366 | - ) |
|
367 | 367 | ), |
368 | 368 | "start_time" => "2016-10-17T07:05:00.090Z" |
369 | 369 | ), 200); |
@@ -390,20 +390,20 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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( |
@@ -77,7 +77,7 @@ discard block |
||
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 |
||
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 |
@@ -91,8 +91,9 @@ |
||
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; |
@@ -54,7 +54,7 @@ discard block |
||
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 |
||
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 |
@@ -91,8 +91,9 @@ |
||
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; |
@@ -79,7 +79,7 @@ discard block |
||
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 |
||
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 |
@@ -91,8 +91,9 @@ |
||
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; |
@@ -146,7 +146,9 @@ |
||
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 |
@@ -39,17 +39,17 @@ discard block |
||
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 |
||
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 |
||
140 | 140 | Exception::CODE_INVALID_ARG); |
141 | 141 | } |
142 | 142 | |
143 | - if ($action!=null && !is_string($action)) { |
|
143 | + if ($action != null && !is_string($action)) { |
|
144 | 144 | throw new Exception("Expected string or null action argument", |
145 | 145 | Exception::CODE_INVALID_ARG); |
146 | 146 | } |
147 | 147 | |
148 | 148 | $queryParams = array(); |
149 | - if ($action!=null) $queryParams['action'] = $action; |
|
149 | + if ($action != null) $queryParams['action'] = $action; |
|
150 | 150 | |
151 | 151 | $postData = $experiment->toArray(); |
152 | 152 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function update($experimentId, $experiment, $action) |
171 | 171 | { |
172 | - if ($experimentId<0) { |
|
172 | + if ($experimentId < 0) { |
|
173 | 173 | throw new Exception("Expected positive experiment ID argument"); |
174 | 174 | } |
175 | 175 |
@@ -36,13 +36,13 @@ |
||
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 |
@@ -61,41 +61,41 @@ discard block |
||
61 | 61 | $options = array( |
62 | 62 | "project_id" => 1000, |
63 | 63 | "changes" => array( |
64 | - array( |
|
64 | + array( |
|
65 | 65 | "type" => "custom_code", |
66 | 66 | "allow_additional_redirect" => true, |
67 | 67 | "async" => true, |
68 | 68 | "selector" => "a[href*=\"optimizely\"]", |
69 | 69 | "dependencies" => array( |
70 | - 24, |
|
71 | - 26 |
|
70 | + 24, |
|
71 | + 26 |
|
72 | 72 | ), |
73 | 73 | "destination" => "https://app.optimizely.com/", |
74 | 74 | "extension_id" => 1234, |
75 | 75 | "preserve_parameters" => true, |
76 | 76 | "src" => 524, |
77 | 77 | "value" => "window.someGlobalFunction();" |
78 | - ) |
|
78 | + ) |
|
79 | 79 | ), |
80 | 80 | "created" => "2016-10-14T05:08:42.822Z", |
81 | 81 | "earliest" => "2016-10-14T05:08:42.822Z", |
82 | 82 | "experiment_ids" => array( |
83 | - 0 |
|
83 | + 0 |
|
84 | 84 | ), |
85 | 85 | "holdback" => 0, |
86 | 86 | "last_modified" => "2016-10-14T05:08:42.822Z", |
87 | 87 | "latest" => "2016-10-14T05:08:42.822Z", |
88 | 88 | "metrics" => array( |
89 | - array( |
|
89 | + array( |
|
90 | 90 | "aggregator" => "unique", |
91 | 91 | "event_id" => 0, |
92 | 92 | "field" => "revenue", |
93 | 93 | "scope" => "session" |
94 | - ) |
|
94 | + ) |
|
95 | 95 | ), |
96 | 96 | "name" => "Landing Page Optimization", |
97 | 97 | "page_ids" => array( |
98 | - 0 |
|
98 | + 0 |
|
99 | 99 | ), |
100 | 100 | "status" => "active", |
101 | 101 | "type" => "a/b" |
@@ -117,41 +117,41 @@ discard block |
||
117 | 117 | $options = array( |
118 | 118 | "project_id" => 1000, |
119 | 119 | "changes" => array( |
120 | - array( |
|
120 | + array( |
|
121 | 121 | "type" => "custom_code", |
122 | 122 | "allow_additional_redirect" => true, |
123 | 123 | "async" => true, |
124 | 124 | "selector" => "a[href*=\"optimizely\"]", |
125 | 125 | "dependencies" => array( |
126 | - 24, |
|
127 | - 26 |
|
126 | + 24, |
|
127 | + 26 |
|
128 | 128 | ), |
129 | 129 | "destination" => "https://app.optimizely.com/", |
130 | 130 | "extension_id" => 1234, |
131 | 131 | "preserve_parameters" => true, |
132 | 132 | "src" => 524, |
133 | 133 | "value" => "window.someGlobalFunction();" |
134 | - ) |
|
134 | + ) |
|
135 | 135 | ), |
136 | 136 | "created" => "2016-10-14T05:08:42.822Z", |
137 | 137 | "earliest" => "2016-10-14T05:08:42.822Z", |
138 | 138 | "experiment_ids" => array( |
139 | - 0 |
|
139 | + 0 |
|
140 | 140 | ), |
141 | 141 | "holdback" => 0, |
142 | 142 | "last_modified" => "2016-10-14T05:08:42.822Z", |
143 | 143 | "latest" => "2016-10-14T05:08:42.822Z", |
144 | 144 | "metrics" => array( |
145 | - array( |
|
145 | + array( |
|
146 | 146 | "aggregator" => "unique", |
147 | 147 | "event_id" => 0, |
148 | 148 | "field" => "revenue", |
149 | 149 | "scope" => "session" |
150 | - ) |
|
150 | + ) |
|
151 | 151 | ), |
152 | 152 | "name" => "Landing Page Optimization", |
153 | 153 | "page_ids" => array( |
154 | - 0 |
|
154 | + 0 |
|
155 | 155 | ), |
156 | 156 | "status" => "active", |
157 | 157 | "type" => "a/b" |