@@ -16,14 +16,14 @@ |
||
16 | 16 | "platform" => "web", |
17 | 17 | "status" => "active", |
18 | 18 | "web_snippet" => array( |
19 | - "enable_force_variation" => false, |
|
20 | - "exclude_disabled_experiments" => false, |
|
21 | - "exclude_names" => true, |
|
22 | - "include_jquery" => true, |
|
23 | - "ip_anonymization" => false, |
|
24 | - "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
25 | - "library" => "jquery-1.11.3-trim", |
|
26 | - "project_javascript" => "alert(\"Active Experiment\")" |
|
19 | + "enable_force_variation" => false, |
|
20 | + "exclude_disabled_experiments" => false, |
|
21 | + "exclude_names" => true, |
|
22 | + "include_jquery" => true, |
|
23 | + "ip_anonymization" => false, |
|
24 | + "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
25 | + "library" => "jquery-1.11.3-trim", |
|
26 | + "project_javascript" => "alert(\"Active Experiment\")" |
|
27 | 27 | )); |
28 | 28 | |
29 | 29 | $result = new Result($data, 200); |
@@ -37,21 +37,21 @@ discard block |
||
37 | 37 | * @return Result |
38 | 38 | * @throws Exception |
39 | 39 | */ |
40 | - public function listAll($projectId, $page=1, $perPage=25) |
|
40 | + public function listAll($projectId, $page = 1, $perPage = 25) |
|
41 | 41 | { |
42 | 42 | if (!is_int($projectId)) { |
43 | 43 | throw new Exception("Integer project ID expected, while got '$projectId'"); |
44 | 44 | } |
45 | 45 | |
46 | - if ($projectId<0) { |
|
46 | + if ($projectId < 0) { |
|
47 | 47 | throw new Exception("Expected positive integer project ID"); |
48 | 48 | } |
49 | 49 | |
50 | - if ($page<0) { |
|
50 | + if ($page < 0) { |
|
51 | 51 | throw new Exception('Invalid page number passed'); |
52 | 52 | } |
53 | 53 | |
54 | - if ($perPage<0 || $perPage>100) { |
|
54 | + if ($perPage < 0 || $perPage > 100) { |
|
55 | 55 | throw new Exception('Invalid page size passed'); |
56 | 56 | } |
57 | 57 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | Exception::CODE_INVALID_ARG); |
108 | 108 | } |
109 | 109 | |
110 | - if ($campaignId<0) { |
|
110 | + if ($campaignId < 0) { |
|
111 | 111 | throw new Exception("Expected positive integer campaign ID", |
112 | 112 | Exception::CODE_INVALID_ARG); |
113 | 113 | } |
@@ -95,7 +95,7 @@ |
||
95 | 95 | /** |
96 | 96 | * Get campaign results |
97 | 97 | * @param integer $campaignId The id for the campaign you want results for |
98 | - * @param string $starTime The earliest time to count events in results. Defaults to the time that the campaign was first activated. |
|
98 | + * @param string $startTime The earliest time to count events in results. Defaults to the time that the campaign was first activated. |
|
99 | 99 | * @param string $endTime The latest time to count events in results. Defaults to the time the campaign was last active or the current time if the campaign is still running. |
100 | 100 | * @return Result |
101 | 101 | * @throws Exception |
@@ -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 |
@@ -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 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | throw new Exception("Expected argument of type Experiment"); |
176 | 176 | } |
177 | 177 | |
178 | - if ($experimentId<0) { |
|
178 | + if ($experimentId < 0) { |
|
179 | 179 | throw new Exception("Expected positive experiment ID argument"); |
180 | 180 | } |
181 | 181 |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | use WebMarketingROI\OptimizelyPHP\Exception; |
17 | 17 | |
18 | 18 | // Init class autloading. |
19 | -include dirname(__FILE__) . '/../../vendor/autoload.php'; |
|
19 | +include dirname(__FILE__).'/../../vendor/autoload.php'; |
|
20 | 20 | |
21 | 21 | // Include Utils.php - a file containing helper functions |
22 | -include dirname(__FILE__) . '/../Utils.php'; |
|
22 | +include dirname(__FILE__).'/../Utils.php'; |
|
23 | 23 | |
24 | 24 | // Read project ID from command line. |
25 | -if ($argc!=2) { |
|
26 | - die('Expected 1 command-line argument, while got ' . $argc-1); |
|
25 | +if ($argc != 2) { |
|
26 | + die('Expected 1 command-line argument, while got '.$argc - 1); |
|
27 | 27 | } |
28 | 28 | $projectId = $argv[1]; |
29 | 29 | |
@@ -47,20 +47,20 @@ discard block |
||
47 | 47 | $experiments = $result->getPayload(); |
48 | 48 | |
49 | 49 | foreach ($experiments as $experiment) { |
50 | - echo "Name: " . $experiment->getName() . "\n"; |
|
51 | - echo "Description: " . $experiment->getDescription() . "\n"; |
|
52 | - echo "Status: " . $experiment->getStatus() . "\n"; |
|
53 | - echo "Created: " . $experiment->getCreated() . "\n"; |
|
50 | + echo "Name: ".$experiment->getName()."\n"; |
|
51 | + echo "Description: ".$experiment->getDescription()."\n"; |
|
52 | + echo "Status: ".$experiment->getStatus()."\n"; |
|
53 | + echo "Created: ".$experiment->getCreated()."\n"; |
|
54 | 54 | |
55 | 55 | echo "\n"; |
56 | 56 | } |
57 | 57 | |
58 | 58 | // Determine if there are more projects. |
59 | - if ($result->getNextPage()==null) |
|
59 | + if ($result->getNextPage() == null) |
|
60 | 60 | break; |
61 | 61 | |
62 | 62 | // Increment page counter. |
63 | - $page ++; |
|
63 | + $page++; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | } catch (Exception $e) { |
@@ -74,6 +74,6 @@ discard block |
||
74 | 74 | |
75 | 75 | // Save access token for later use |
76 | 76 | $accessToken = $optimizelyClient->getAccessToken(); |
77 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
77 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
78 | 78 | |
79 | 79 | echo "Done!\n"; |
@@ -55,8 +55,9 @@ |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | // Determine if there are more projects. |
58 | - if ($result->getNextPage()==null) |
|
59 | - break; |
|
58 | + if ($result->getNextPage()==null) { |
|
59 | + break; |
|
60 | + } |
|
60 | 61 | |
61 | 62 | // Increment page counter. |
62 | 63 | $page ++; |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | "category" => "add_to_cart", |
25 | 25 | "description" => "Item added to cart", |
26 | 26 | "event_filter" => array( |
27 | - "filter_type" => "target_selector", |
|
28 | - "selector" => ".menu-options" |
|
27 | + "filter_type" => "target_selector", |
|
28 | + "selector" => ".menu-options" |
|
29 | 29 | ), |
30 | 30 | "event_type" => "custom", |
31 | 31 | "key" => "add_to_cart", |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | "category" => "add_to_cart", |
65 | 65 | "description" => "Item added to cart", |
66 | 66 | "event_filter" => array( |
67 | - "filter_type" => "target_selector", |
|
68 | - "selector" => ".menu-options" |
|
67 | + "filter_type" => "target_selector", |
|
68 | + "selector" => ".menu-options" |
|
69 | 69 | ), |
70 | 70 | "event_type" => "custom", |
71 | 71 | "key" => "add_to_cart", |
@@ -98,22 +98,22 @@ discard block |
||
98 | 98 | ->getMock(); |
99 | 99 | |
100 | 100 | $result = new Result(array( |
101 | - "event_filter" => array( |
|
101 | + "event_filter" => array( |
|
102 | 102 | "filter_type" => "target_selector", |
103 | 103 | "selector" => ".menu-options" |
104 | - ), |
|
105 | - "name" => "Add to Cart", |
|
106 | - "archived" => true, |
|
107 | - "category" => "add_to_cart", |
|
108 | - "description" => "string", |
|
109 | - "event_type" => "click", |
|
110 | - "key" => "add_to_cart", |
|
111 | - "created" => "2016-10-18T05:07:04.153Z", |
|
112 | - "id" => 0, |
|
113 | - "is_classic" => false, |
|
114 | - "is_editable" => true, |
|
115 | - "page_id" => 0, |
|
116 | - "project_id" => 1000 |
|
104 | + ), |
|
105 | + "name" => "Add to Cart", |
|
106 | + "archived" => true, |
|
107 | + "category" => "add_to_cart", |
|
108 | + "description" => "string", |
|
109 | + "event_type" => "click", |
|
110 | + "key" => "add_to_cart", |
|
111 | + "created" => "2016-10-18T05:07:04.153Z", |
|
112 | + "id" => 0, |
|
113 | + "is_classic" => false, |
|
114 | + "is_editable" => true, |
|
115 | + "page_id" => 0, |
|
116 | + "project_id" => 1000 |
|
117 | 117 | ), 201); |
118 | 118 | |
119 | 119 | $optimizelyApiClientMock->method('sendApiRequest') |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | $eventsService = new Events($optimizelyApiClientMock); |
123 | 123 | |
124 | 124 | $event = new ClickEvent(array( |
125 | - "event_filter" => array( |
|
125 | + "event_filter" => array( |
|
126 | 126 | "filter_type" => "target_selector", |
127 | 127 | "selector" => ".menu-options" |
128 | - ), |
|
129 | - "name" => "Add to Cart", |
|
130 | - "archived" => true, |
|
131 | - "category" => "add_to_cart", |
|
132 | - "description" => "string", |
|
133 | - "event_type" => "click", |
|
134 | - "key" => "add_to_cart" |
|
128 | + ), |
|
129 | + "name" => "Add to Cart", |
|
130 | + "archived" => true, |
|
131 | + "category" => "add_to_cart", |
|
132 | + "description" => "string", |
|
133 | + "event_type" => "click", |
|
134 | + "key" => "add_to_cart" |
|
135 | 135 | )); |
136 | 136 | |
137 | 137 | $result = $eventsService->createClickEvent(0, $event); |
@@ -192,22 +192,22 @@ discard block |
||
192 | 192 | ->getMock(); |
193 | 193 | |
194 | 194 | $result = new Result(array( |
195 | - "event_filter" => array( |
|
195 | + "event_filter" => array( |
|
196 | 196 | "filter_type" => "target_selector", |
197 | 197 | "selector" => ".menu-options" |
198 | - ), |
|
199 | - "name" => "Add to Cart", |
|
200 | - "archived" => true, |
|
201 | - "category" => "add_to_cart", |
|
202 | - "description" => "string", |
|
203 | - "event_type" => "click", |
|
204 | - "key" => "add_to_cart", |
|
205 | - "created" => "2016-10-18T05:07:04.153Z", |
|
206 | - "id" => 0, |
|
207 | - "is_classic" => false, |
|
208 | - "is_editable" => true, |
|
209 | - "page_id" => 0, |
|
210 | - "project_id" => 1000 |
|
198 | + ), |
|
199 | + "name" => "Add to Cart", |
|
200 | + "archived" => true, |
|
201 | + "category" => "add_to_cart", |
|
202 | + "description" => "string", |
|
203 | + "event_type" => "click", |
|
204 | + "key" => "add_to_cart", |
|
205 | + "created" => "2016-10-18T05:07:04.153Z", |
|
206 | + "id" => 0, |
|
207 | + "is_classic" => false, |
|
208 | + "is_editable" => true, |
|
209 | + "page_id" => 0, |
|
210 | + "project_id" => 1000 |
|
211 | 211 | ), 200); |
212 | 212 | |
213 | 213 | $optimizelyApiClientMock->method('sendApiRequest') |
@@ -216,16 +216,16 @@ discard block |
||
216 | 216 | $eventsService = new Events($optimizelyApiClientMock); |
217 | 217 | |
218 | 218 | $event = new ClickEvent(array( |
219 | - "event_filter" => array( |
|
219 | + "event_filter" => array( |
|
220 | 220 | "filter_type" => "target_selector", |
221 | 221 | "selector" => ".menu-options" |
222 | - ), |
|
223 | - "name" => "Add to Cart", |
|
224 | - "archived" => true, |
|
225 | - "category" => "add_to_cart", |
|
226 | - "description" => "string", |
|
227 | - "event_type" => "click", |
|
228 | - "key" => "add_to_cart" |
|
222 | + ), |
|
223 | + "name" => "Add to Cart", |
|
224 | + "archived" => true, |
|
225 | + "category" => "add_to_cart", |
|
226 | + "description" => "string", |
|
227 | + "event_type" => "click", |
|
228 | + "key" => "add_to_cart" |
|
229 | 229 | )); |
230 | 230 | |
231 | 231 | $result = $eventsService->updateClickEvent(0, 0, $event); |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | $result = $eventsService->listAll(1000, true); |
48 | 48 | $events = $result->getPayload(); |
49 | 49 | |
50 | - $this->assertTrue(count($events)==1); |
|
50 | + $this->assertTrue(count($events) == 1); |
|
51 | 51 | $this->assertTrue($events[0] instanceOf Event); |
52 | - $this->assertTrue($events[0]->getName()=='Add to Cart'); |
|
52 | + $this->assertTrue($events[0]->getName() == 'Add to Cart'); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | public function testGet() |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $event = $result->getPayload(); |
88 | 88 | |
89 | 89 | $this->assertTrue($event instanceOf Event); |
90 | - $this->assertTrue($event->getName()=='Add to Cart'); |
|
90 | + $this->assertTrue($event->getName() == 'Add to Cart'); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | public function testCreateClickEvent() |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $createdEvent = $result->getPayload(); |
139 | 139 | |
140 | 140 | $this->assertTrue($createdEvent instanceOf ClickEvent); |
141 | - $this->assertTrue($createdEvent->getName()=='Add to Cart'); |
|
141 | + $this->assertTrue($createdEvent->getName() == 'Add to Cart'); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | public function testCreateCustomEvent() |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $createdEvent = $result->getPayload(); |
182 | 182 | |
183 | 183 | $this->assertTrue($createdEvent instanceOf CustomEvent); |
184 | - $this->assertTrue($createdEvent->getName()=='Loaded New App'); |
|
184 | + $this->assertTrue($createdEvent->getName() == 'Loaded New App'); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | public function testUpdateClickEvent() |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $updatedEvent = $result->getPayload(); |
233 | 233 | |
234 | 234 | $this->assertTrue($updatedEvent instanceOf ClickEvent); |
235 | - $this->assertTrue($updatedEvent->getName()=='Add to Cart'); |
|
235 | + $this->assertTrue($updatedEvent->getName() == 'Add to Cart'); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | public function testUpdateCustomEvent() |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $updatedEvent = $result->getPayload(); |
276 | 276 | |
277 | 277 | $this->assertTrue($updatedEvent instanceOf CustomEvent); |
278 | - $this->assertTrue($updatedEvent->getName()=='Loaded New App'); |
|
278 | + $this->assertTrue($updatedEvent->getName() == 'Loaded New App'); |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | array( |
22 | 22 | "project_id" => 1000, |
23 | 23 | "changes" => array( |
24 | - array( |
|
24 | + array( |
|
25 | 25 | "type" => "custom_code", |
26 | 26 | "allow_additional_redirect" => true, |
27 | 27 | "async" => true, |
28 | 28 | "css_selector" => "a[href*=\"optimizely\"]", |
29 | 29 | "dependencies" => array( |
30 | - 24, |
|
31 | - 26 |
|
30 | + 24, |
|
31 | + 26 |
|
32 | 32 | ), |
33 | 33 | "destination" => "https://app.optimizely.com/", |
34 | 34 | "extension_id" => 1234, |
@@ -36,30 +36,30 @@ discard block |
||
36 | 36 | "src" => 524, |
37 | 37 | "value" => "window.someGlobalFunction();", |
38 | 38 | "id" => "string" |
39 | - ) |
|
39 | + ) |
|
40 | 40 | ), |
41 | 41 | "created" => "2016-10-18T03:27:04.123Z", |
42 | 42 | "earliest" => "2016-10-18T03:27:04.123Z", |
43 | 43 | "experiment_ids" => array( |
44 | - 0 |
|
44 | + 0 |
|
45 | 45 | ), |
46 | 46 | "holdback" => 0, |
47 | 47 | "last_modified" => "2016-10-18T03:27:04.123Z", |
48 | 48 | "latest" => "2016-10-18T03:27:04.123Z", |
49 | 49 | "metrics" => array( |
50 | - array( |
|
50 | + array( |
|
51 | 51 | "kind" => "string", |
52 | 52 | "id" => 0 |
53 | - ) |
|
53 | + ) |
|
54 | 54 | ), |
55 | 55 | "name" => "Landing Page Optimization", |
56 | 56 | "page_ids" => array( |
57 | - 0 |
|
57 | + 0 |
|
58 | 58 | ), |
59 | 59 | "status" => "active", |
60 | 60 | "type" => "a/b", |
61 | 61 | "id" => 2000 |
62 | - ) |
|
62 | + ) |
|
63 | 63 | ), 200); |
64 | 64 | |
65 | 65 | $optimizelyApiClientMock->method('sendApiRequest') |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | $result = new Result(array( |
116 | 116 | "project_id" => 1000, |
117 | 117 | "changes" => array( |
118 | - array( |
|
118 | + array( |
|
119 | 119 | "type" => "custom_code", |
120 | 120 | "allow_additional_redirect" => true, |
121 | 121 | "async" => true, |
122 | 122 | "css_selector" => "a[href*=\"optimizely\"]", |
123 | 123 | "dependencies" => array( |
124 | - 24, |
|
125 | - 26 |
|
124 | + 24, |
|
125 | + 26 |
|
126 | 126 | ), |
127 | 127 | "destination" => "https://app.optimizely.com/", |
128 | 128 | "extension_id" => 1234, |
@@ -130,25 +130,25 @@ discard block |
||
130 | 130 | "src" => 524, |
131 | 131 | "value" => "window.someGlobalFunction();", |
132 | 132 | "id" => "string" |
133 | - ) |
|
133 | + ) |
|
134 | 134 | ), |
135 | 135 | "created" => "2016-10-18T03:27:04.139Z", |
136 | 136 | "earliest" => "2016-10-18T03:27:04.139Z", |
137 | 137 | "experiment_ids" => array( |
138 | - 0 |
|
138 | + 0 |
|
139 | 139 | ), |
140 | 140 | "holdback" => 0, |
141 | 141 | "last_modified" => "2016-10-18T03:27:04.139Z", |
142 | 142 | "latest" => "2016-10-18T03:27:04.139Z", |
143 | 143 | "metrics" => array( |
144 | - array( |
|
144 | + array( |
|
145 | 145 | "kind" => "string", |
146 | 146 | "id" => 0 |
147 | - ) |
|
147 | + ) |
|
148 | 148 | ), |
149 | 149 | "name" => "Landing Page Optimization", |
150 | 150 | "page_ids" => array( |
151 | - 0 |
|
151 | + 0 |
|
152 | 152 | ), |
153 | 153 | "status" => "active", |
154 | 154 | "type" => "a/b", |
@@ -179,47 +179,47 @@ discard block |
||
179 | 179 | "confidence_threshold" => 0, |
180 | 180 | "end_time" => "2016-10-18T03:27:04.147Z", |
181 | 181 | "metrics" => array( |
182 | - array( |
|
182 | + array( |
|
183 | 183 | "event" => "string", |
184 | 184 | "event_name" => "string", |
185 | 185 | "measure" => "conversions", |
186 | 186 | "metric_id" => "string", |
187 | 187 | "priority" => 0, |
188 | 188 | "results" => array( |
189 | - "campaign" => array( |
|
189 | + "campaign" => array( |
|
190 | 190 | "experiment_id" => 0, |
191 | 191 | "is_baseline" => true, |
192 | 192 | "lift" => array( |
193 | - "confidence_interval" => array( |
|
193 | + "confidence_interval" => array( |
|
194 | 194 | 0.010399560300730457, |
195 | 195 | 0.0850821459929161 |
196 | - ), |
|
197 | - "is_most_conclusive" => true, |
|
198 | - "is_significant" => true, |
|
199 | - "significance" => 0, |
|
200 | - "value" => 0, |
|
201 | - "visitors_remaining" => 0 |
|
196 | + ), |
|
197 | + "is_most_conclusive" => true, |
|
198 | + "is_significant" => true, |
|
199 | + "significance" => 0, |
|
200 | + "value" => 0, |
|
201 | + "visitors_remaining" => 0 |
|
202 | 202 | ), |
203 | 203 | "name" => "Blue Button", |
204 | 204 | "rate" => 0, |
205 | 205 | "scope" => "variation", |
206 | 206 | "total_increase" => array( |
207 | - "confidence_interval" => array( |
|
207 | + "confidence_interval" => array( |
|
208 | 208 | 0.010399560300730457, |
209 | 209 | 0.0850821459929161 |
210 | - ), |
|
211 | - "is_most_conclusive" => true, |
|
212 | - "is_significant" => true, |
|
213 | - "significance" => 0, |
|
214 | - "value" => 0, |
|
215 | - "visitors_remaining" => 0 |
|
210 | + ), |
|
211 | + "is_most_conclusive" => true, |
|
212 | + "is_significant" => true, |
|
213 | + "significance" => 0, |
|
214 | + "value" => 0, |
|
215 | + "visitors_remaining" => 0 |
|
216 | 216 | ), |
217 | 217 | "value" => 0, |
218 | 218 | "variation_id" => "string" |
219 | - ) |
|
219 | + ) |
|
220 | 220 | ), |
221 | 221 | "unit" => "session" |
222 | - ) |
|
222 | + ) |
|
223 | 223 | ), |
224 | 224 | "start_time" => "2016-10-18T03:27:04.148Z" |
225 | 225 | ), 200); |
@@ -247,14 +247,14 @@ discard block |
||
247 | 247 | $result = new Result(array( |
248 | 248 | "project_id" => 1000, |
249 | 249 | "changes" => array( |
250 | - array( |
|
250 | + array( |
|
251 | 251 | "type" => "custom_code", |
252 | 252 | "allow_additional_redirect" => true, |
253 | 253 | "async" => true, |
254 | 254 | "css_selector" => "a[href*=\"optimizely\"]", |
255 | 255 | "dependencies" => array( |
256 | - 24, |
|
257 | - 26 |
|
256 | + 24, |
|
257 | + 26 |
|
258 | 258 | ), |
259 | 259 | "destination" => "https://app.optimizely.com/", |
260 | 260 | "extension_id" => 1234, |
@@ -262,25 +262,25 @@ discard block |
||
262 | 262 | "src" => 524, |
263 | 263 | "value" => "window.someGlobalFunction();", |
264 | 264 | "id" => "string" |
265 | - ) |
|
265 | + ) |
|
266 | 266 | ), |
267 | 267 | "created" => "2016-10-18T03:27:04.155Z", |
268 | 268 | "earliest" => "2016-10-18T03:27:04.155Z", |
269 | 269 | "experiment_ids" => array( |
270 | - 0 |
|
270 | + 0 |
|
271 | 271 | ), |
272 | 272 | "holdback" => 0, |
273 | 273 | "last_modified" => "2016-10-18T03:27:04.155Z", |
274 | 274 | "latest" => "2016-10-18T03:27:04.155Z", |
275 | 275 | "metrics" => array( |
276 | - array( |
|
276 | + array( |
|
277 | 277 | "kind" => "string", |
278 | 278 | "id" => 0 |
279 | - ) |
|
279 | + ) |
|
280 | 280 | ), |
281 | 281 | "name" => "Landing Page Optimization", |
282 | 282 | "page_ids" => array( |
283 | - 0 |
|
283 | + 0 |
|
284 | 284 | ), |
285 | 285 | "status" => "active", |
286 | 286 | "type" => "a/b", |
@@ -295,38 +295,38 @@ discard block |
||
295 | 295 | $campaign = new Campaign(array( |
296 | 296 | "project_id" => 1000, |
297 | 297 | "changes" => array( |
298 | - array( |
|
298 | + array( |
|
299 | 299 | "type" => "custom_code", |
300 | 300 | "allow_additional_redirect" => true, |
301 | 301 | "async" => true, |
302 | 302 | "css_selector" => "a[href*=\"optimizely\"]", |
303 | 303 | "dependencies" => array( |
304 | - 24, |
|
305 | - 26 |
|
304 | + 24, |
|
305 | + 26 |
|
306 | 306 | ), |
307 | 307 | "destination" => "https://app.optimizely.com/", |
308 | 308 | "extension_id" => 1234, |
309 | 309 | "preserve_parameters" => true, |
310 | 310 | "src" => 524, |
311 | 311 | "value" => "window.someGlobalFunction();" |
312 | - ) |
|
312 | + ) |
|
313 | 313 | ), |
314 | 314 | "created" => "2016-10-18T03:27:04.067Z", |
315 | 315 | "earliest" => "2016-10-18T03:27:04.067Z", |
316 | 316 | "experiment_ids" => array( |
317 | - 0 |
|
317 | + 0 |
|
318 | 318 | ), |
319 | 319 | "holdback" => 0, |
320 | 320 | "last_modified" => "2016-10-18T03:27:04.067Z", |
321 | 321 | "latest" => "2016-10-18T03:27:04.067Z", |
322 | 322 | "metrics" => array( |
323 | - array( |
|
323 | + array( |
|
324 | 324 | "kind" => "string" |
325 | - ) |
|
325 | + ) |
|
326 | 326 | ), |
327 | 327 | "name" => "Landing Page Optimization", |
328 | 328 | "page_ids" => array( |
329 | - 0 |
|
329 | + 0 |
|
330 | 330 | ), |
331 | 331 | "status" => "active", |
332 | 332 | "type" => "a/b" |
@@ -349,14 +349,14 @@ discard block |
||
349 | 349 | $result = new Result(array( |
350 | 350 | "project_id" => 1000, |
351 | 351 | "changes" => array( |
352 | - array( |
|
352 | + array( |
|
353 | 353 | "type" => "custom_code", |
354 | 354 | "allow_additional_redirect" => true, |
355 | 355 | "async" => true, |
356 | 356 | "css_selector" => "a[href*=\"optimizely\"]", |
357 | 357 | "dependencies" => array( |
358 | - 24, |
|
359 | - 26 |
|
358 | + 24, |
|
359 | + 26 |
|
360 | 360 | ), |
361 | 361 | "destination" => "https://app.optimizely.com/", |
362 | 362 | "extension_id" => 1234, |
@@ -364,25 +364,25 @@ discard block |
||
364 | 364 | "src" => 524, |
365 | 365 | "value" => "window.someGlobalFunction();", |
366 | 366 | "id" => "string" |
367 | - ) |
|
367 | + ) |
|
368 | 368 | ), |
369 | 369 | "created" => "2016-10-18T03:27:04.155Z", |
370 | 370 | "earliest" => "2016-10-18T03:27:04.155Z", |
371 | 371 | "experiment_ids" => array( |
372 | - 0 |
|
372 | + 0 |
|
373 | 373 | ), |
374 | 374 | "holdback" => 0, |
375 | 375 | "last_modified" => "2016-10-18T03:27:04.155Z", |
376 | 376 | "latest" => "2016-10-18T03:27:04.155Z", |
377 | 377 | "metrics" => array( |
378 | - array( |
|
378 | + array( |
|
379 | 379 | "kind" => "string", |
380 | 380 | "id" => 0 |
381 | - ) |
|
381 | + ) |
|
382 | 382 | ), |
383 | 383 | "name" => "Landing Page Optimization", |
384 | 384 | "page_ids" => array( |
385 | - 0 |
|
385 | + 0 |
|
386 | 386 | ), |
387 | 387 | "status" => "active", |
388 | 388 | "type" => "a/b", |
@@ -397,38 +397,38 @@ discard block |
||
397 | 397 | $campaign = new Campaign(array( |
398 | 398 | "project_id" => 1000, |
399 | 399 | "changes" => array( |
400 | - array( |
|
400 | + array( |
|
401 | 401 | "type" => "custom_code", |
402 | 402 | "allow_additional_redirect" => true, |
403 | 403 | "async" => true, |
404 | 404 | "css_selector" => "a[href*=\"optimizely\"]", |
405 | 405 | "dependencies" => array( |
406 | - 24, |
|
407 | - 26 |
|
406 | + 24, |
|
407 | + 26 |
|
408 | 408 | ), |
409 | 409 | "destination" => "https://app.optimizely.com/", |
410 | 410 | "extension_id" => 1234, |
411 | 411 | "preserve_parameters" => true, |
412 | 412 | "src" => 524, |
413 | 413 | "value" => "window.someGlobalFunction();" |
414 | - ) |
|
414 | + ) |
|
415 | 415 | ), |
416 | 416 | "created" => "2016-10-18T03:27:04.067Z", |
417 | 417 | "earliest" => "2016-10-18T03:27:04.067Z", |
418 | 418 | "experiment_ids" => array( |
419 | - 0 |
|
419 | + 0 |
|
420 | 420 | ), |
421 | 421 | "holdback" => 0, |
422 | 422 | "last_modified" => "2016-10-18T03:27:04.067Z", |
423 | 423 | "latest" => "2016-10-18T03:27:04.067Z", |
424 | 424 | "metrics" => array( |
425 | - array( |
|
425 | + array( |
|
426 | 426 | "kind" => "string" |
427 | - ) |
|
427 | + ) |
|
428 | 428 | ), |
429 | 429 | "name" => "Landing Page Optimization", |
430 | 430 | "page_ids" => array( |
431 | - 0 |
|
431 | + 0 |
|
432 | 432 | ), |
433 | 433 | "status" => "active", |
434 | 434 | "type" => "a/b" |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | $result = $campaignsService->listAll(1000); |
71 | 71 | $campaigns = $result->getPayload(); |
72 | 72 | |
73 | - $this->assertTrue(count($campaigns)==1); |
|
73 | + $this->assertTrue(count($campaigns) == 1); |
|
74 | 74 | $this->assertTrue($campaigns[0] instanceOf Campaign); |
75 | - $this->assertTrue($campaigns[0]->getName()=='Landing Page Optimization'); |
|
75 | + $this->assertTrue($campaigns[0]->getName() == 'Landing Page Optimization'); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $campaign = $result->getPayload(); |
165 | 165 | |
166 | 166 | $this->assertTrue($campaign instanceOf Campaign); |
167 | - $this->assertTrue($campaign->getName()=='Landing Page Optimization'); |
|
167 | + $this->assertTrue($campaign->getName() == 'Landing Page Optimization'); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | public function testGetResults() |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | $campaignResults = $result->getPayload(); |
234 | 234 | |
235 | 235 | $this->assertTrue($campaignResults instanceOf CampaignResults); |
236 | - $this->assertTrue($campaignResults->getConfidenceThreshold()==0); |
|
237 | - $this->assertTrue($campaignResults->getStartTime()=="2016-10-18T03:27:04.148Z"); |
|
236 | + $this->assertTrue($campaignResults->getConfidenceThreshold() == 0); |
|
237 | + $this->assertTrue($campaignResults->getStartTime() == "2016-10-18T03:27:04.148Z"); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | public function testCreate() |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | $createdCampaign = $result->getPayload(); |
337 | 337 | |
338 | 338 | $this->assertTrue($createdCampaign instanceOf Campaign); |
339 | - $this->assertTrue($createdCampaign->getName()=='Landing Page Optimization'); |
|
339 | + $this->assertTrue($createdCampaign->getName() == 'Landing Page Optimization'); |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | public function testUpdate() |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | $updatedCampaign = $result->getPayload(); |
439 | 439 | |
440 | 440 | $this->assertTrue($updatedCampaign instanceOf Campaign); |
441 | - $this->assertTrue($updatedCampaign->getName()=='Landing Page Optimization'); |
|
441 | + $this->assertTrue($updatedCampaign->getName() == 'Landing Page Optimization'); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | public function testDelete() |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | * @return Result |
36 | 36 | * @throws Exception |
37 | 37 | */ |
38 | - public function listAll($page=1, $perPage=25) |
|
38 | + public function listAll($page = 1, $perPage = 25) |
|
39 | 39 | { |
40 | - if ($page<0) { |
|
40 | + if ($page < 0) { |
|
41 | 41 | throw new Exception('Invalid page number passed'); |
42 | 42 | } |
43 | 43 | |
44 | - if ($perPage<0 || $perPage>100) { |
|
44 | + if ($perPage < 0 || $perPage > 100) { |
|
45 | 45 | throw new Exception('Invalid page size passed'); |
46 | 46 | } |
47 | 47 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function get($projectId) |
71 | 71 | { |
72 | - $projectId = (string)$projectId; |
|
72 | + $projectId = (string) $projectId; |
|
73 | 73 | |
74 | 74 | if (!preg_match('/^\d+$/', $projectId)) { |
75 | 75 | throw new Exception("A positive integer project ID expected, while got $projectId"); |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function update($projectId, $project) |
116 | 116 | { |
117 | - $projectId = (string)$projectId; |
|
117 | + $projectId = (string) $projectId; |
|
118 | 118 | |
119 | 119 | if (!preg_match('/\d+/', $projectId)) { |
120 | 120 | throw new Exception("A positive integer project ID expected, while got $projectId"); |
121 | 121 | } |
122 | 122 | |
123 | - if ($projectId<0) { |
|
123 | + if ($projectId < 0) { |
|
124 | 124 | throw new Exception("A positive project ID expected"); |
125 | 125 | } |
126 | 126 |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | case 'last_modified': $this->setLastModified($value); break; |
123 | 123 | case 'socket_token': $this->setSocketToken($value); break; |
124 | 124 | default: |
125 | - throw new Exception('Unknown option: ' . $name); |
|
125 | + throw new Exception('Unknown option: '.$name); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | 'platform' => $this->getPlatform(), |
141 | 141 | 'sdks' => $this->getSdks(), |
142 | 142 | 'status' => $this->getStatus(), |
143 | - 'web_snippet' => $this->getWebSnippet()?$this->getWebSnippet()->toArray():null, |
|
143 | + 'web_snippet' => $this->getWebSnippet() ? $this->getWebSnippet()->toArray() : null, |
|
144 | 144 | 'created' => $this->getCreated(), |
145 | 145 | 'id' => $this->getId(), |
146 | 146 | 'is_classic' => $this->getIsClassic(), |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | // Remove options with empty values |
152 | 152 | $cleanedOptions = array(); |
153 | 153 | foreach ($options as $name=>$value) { |
154 | - if ($value!==null) |
|
154 | + if ($value !== null) |
|
155 | 155 | $cleanedOptions[$name] = $value; |
156 | 156 | } |
157 | 157 |
@@ -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; |