@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | "platform" => "web", |
110 | 110 | "status" => "active", |
111 | 111 | "web_snippet" => array( |
112 | - "enable_force_variation" => false, |
|
113 | - "exclude_disabled_experiments" => false, |
|
114 | - "exclude_names" => true, |
|
115 | - "include_jquery" => true, |
|
116 | - "ip_anonymization" => false, |
|
117 | - "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
118 | - "library" => "jquery-1.11.3-trim", |
|
119 | - "project_javascript" => "alert(\"Active Experiment\")", |
|
120 | - "code_revision" => 0, |
|
121 | - "js_file_size" => 63495 |
|
112 | + "enable_force_variation" => false, |
|
113 | + "exclude_disabled_experiments" => false, |
|
114 | + "exclude_names" => true, |
|
115 | + "include_jquery" => true, |
|
116 | + "ip_anonymization" => false, |
|
117 | + "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
118 | + "library" => "jquery-1.11.3-trim", |
|
119 | + "project_javascript" => "alert(\"Active Experiment\")", |
|
120 | + "code_revision" => 0, |
|
121 | + "js_file_size" => 63495 |
|
122 | 122 | ), |
123 | 123 | "created" => "2016-10-17T07:04:59.991Z", |
124 | 124 | "id" => 1000, |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | "platform" => "web", |
138 | 138 | "status" => "active", |
139 | 139 | "web_snippet" => array( |
140 | - "enable_force_variation" => false, |
|
141 | - "exclude_disabled_experiments" => false, |
|
142 | - "exclude_names" => true, |
|
143 | - "include_jquery" => true, |
|
144 | - "ip_anonymization" => false, |
|
145 | - "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
146 | - "library" => "jquery-1.11.3-trim", |
|
147 | - "project_javascript" => "alert(\"Active Experiment\")" |
|
140 | + "enable_force_variation" => false, |
|
141 | + "exclude_disabled_experiments" => false, |
|
142 | + "exclude_names" => true, |
|
143 | + "include_jquery" => true, |
|
144 | + "ip_anonymization" => false, |
|
145 | + "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
146 | + "library" => "jquery-1.11.3-trim", |
|
147 | + "project_javascript" => "alert(\"Active Experiment\")" |
|
148 | 148 | ) |
149 | 149 | )); |
150 | 150 | |
@@ -173,16 +173,16 @@ discard block |
||
173 | 173 | "platform" => "web", |
174 | 174 | "status" => "active", |
175 | 175 | "web_snippet" => array( |
176 | - "enable_force_variation" => false, |
|
177 | - "exclude_disabled_experiments" => false, |
|
178 | - "exclude_names" => true, |
|
179 | - "include_jquery" => true, |
|
180 | - "ip_anonymization" => false, |
|
181 | - "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
182 | - "library" => "jquery-1.11.3-trim", |
|
183 | - "project_javascript" => "alert(\"Active Experiment\")", |
|
184 | - "code_revision" => 0, |
|
185 | - "js_file_size" => 63495 |
|
176 | + "enable_force_variation" => false, |
|
177 | + "exclude_disabled_experiments" => false, |
|
178 | + "exclude_names" => true, |
|
179 | + "include_jquery" => true, |
|
180 | + "ip_anonymization" => false, |
|
181 | + "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
182 | + "library" => "jquery-1.11.3-trim", |
|
183 | + "project_javascript" => "alert(\"Active Experiment\")", |
|
184 | + "code_revision" => 0, |
|
185 | + "js_file_size" => 63495 |
|
186 | 186 | ), |
187 | 187 | "created" => "2016-10-17T07:04:59.999Z", |
188 | 188 | "id" => 1000, |
@@ -199,14 +199,14 @@ discard block |
||
199 | 199 | "name" => "Test Project", |
200 | 200 | "status" => "active", |
201 | 201 | "web_snippet" => array( |
202 | - "enable_force_variation" => false, |
|
203 | - "exclude_disabled_experiments" => false, |
|
204 | - "exclude_names" => true, |
|
205 | - "include_jquery" => true, |
|
206 | - "ip_anonymization" => false, |
|
207 | - "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
208 | - "library" => "jquery-1.11.3-trim", |
|
209 | - "project_javascript" => "alert(\"Active Experiment\")" |
|
202 | + "enable_force_variation" => false, |
|
203 | + "exclude_disabled_experiments" => false, |
|
204 | + "exclude_names" => true, |
|
205 | + "include_jquery" => true, |
|
206 | + "ip_anonymization" => false, |
|
207 | + "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
208 | + "library" => "jquery-1.11.3-trim", |
|
209 | + "project_javascript" => "alert(\"Active Experiment\")" |
|
210 | 210 | ) |
211 | 211 | )); |
212 | 212 | |
@@ -236,14 +236,14 @@ discard block |
||
236 | 236 | "platform" => "web", |
237 | 237 | "status" => "active", |
238 | 238 | "web_snippet" => array( |
239 | - "enable_force_variation" => false, |
|
240 | - "exclude_disabled_experiments" => false, |
|
241 | - "exclude_names" => true, |
|
242 | - "include_jquery" => true, |
|
243 | - "ip_anonymization" => false, |
|
244 | - "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
245 | - "library" => "jquery-1.11.3-trim", |
|
246 | - "project_javascript" => "alert(\"Active Experiment\")" |
|
239 | + "enable_force_variation" => false, |
|
240 | + "exclude_disabled_experiments" => false, |
|
241 | + "exclude_names" => true, |
|
242 | + "include_jquery" => true, |
|
243 | + "ip_anonymization" => false, |
|
244 | + "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
245 | + "library" => "jquery-1.11.3-trim", |
|
246 | + "project_javascript" => "alert(\"Active Experiment\")" |
|
247 | 247 | ) |
248 | 248 | )); |
249 | 249 |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | $result = $projectsService->listAll(); |
52 | 52 | $projects = $result->getPayload(); |
53 | 53 | |
54 | - $this->assertTrue(count($projects)==1); |
|
54 | + $this->assertTrue(count($projects) == 1); |
|
55 | 55 | $this->assertTrue($projects[0] instanceOf Project); |
56 | - $this->assertTrue($projects[0]->getName()=='Some Optimizely Project'); |
|
56 | + $this->assertTrue($projects[0]->getName() == 'Some Optimizely Project'); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $project = $result->getPayload(); |
127 | 127 | |
128 | 128 | $this->assertTrue($project instanceOf Project); |
129 | - $this->assertTrue($project->getName()=='Some Optimizely Project'); |
|
129 | + $this->assertTrue($project->getName() == 'Some Optimizely Project'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | $createdProject = $result->getPayload(); |
222 | 222 | |
223 | 223 | $this->assertTrue($createdProject instanceOf Project); |
224 | - $this->assertTrue($createdProject->getName()=='Test Project'); |
|
225 | - $this->assertTrue($createdProject->getAccountId()==12345); |
|
224 | + $this->assertTrue($createdProject->getName() == 'Test Project'); |
|
225 | + $this->assertTrue($createdProject->getAccountId() == 12345); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -301,8 +301,8 @@ discard block |
||
301 | 301 | $updatedProject = $result->getPayload(); |
302 | 302 | |
303 | 303 | $this->assertTrue($updatedProject instanceOf Project); |
304 | - $this->assertTrue($updatedProject->getName()=='Test Project'); |
|
305 | - $this->assertTrue($updatedProject->getAccountId()==12345); |
|
304 | + $this->assertTrue($updatedProject->getName() == 'Test Project'); |
|
305 | + $this->assertTrue($updatedProject->getAccountId() == 12345); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $credentials = $this->loadCredentialsFromFile(); |
363 | 363 | |
364 | 364 | $optimizelyClient = new OptimizelyApiClient($credentials, 'v2'); |
365 | - $this->assertTrue($optimizelyClient!=null); |
|
365 | + $this->assertTrue($optimizelyClient != null); |
|
366 | 366 | |
367 | 367 | // Create new project |
368 | 368 | $curDate = date('Y-m-d H:i:s'); |
@@ -387,9 +387,9 @@ discard block |
||
387 | 387 | $result = $optimizelyClient->projects()->create($newProject); |
388 | 388 | |
389 | 389 | $this->assertEquals(200, $result->getHttpCode()); |
390 | - $this->assertTrue($result->getRateLimit()>0); |
|
391 | - $this->assertTrue($result->getRateLimitRemaining()>0); |
|
392 | - $this->assertTrue($result->getRateLimitReset()>0); |
|
390 | + $this->assertTrue($result->getRateLimit() > 0); |
|
391 | + $this->assertTrue($result->getRateLimitRemaining() > 0); |
|
392 | + $this->assertTrue($result->getRateLimitReset() > 0); |
|
393 | 393 | |
394 | 394 | $createdProject = $result->getPayload(); |
395 | 395 | |
@@ -411,18 +411,18 @@ discard block |
||
411 | 411 | $projects = $result->getPayload(); |
412 | 412 | |
413 | 413 | foreach ($projects as $project) { |
414 | - echo "Name: " . $project->getName() . "\n"; |
|
415 | - if ($project->getName()=="Test Project $curDate") { |
|
414 | + echo "Name: ".$project->getName()."\n"; |
|
415 | + if ($project->getName() == "Test Project $curDate") { |
|
416 | 416 | $projectId = $project->getId(); |
417 | 417 | $projectFound = true; |
418 | 418 | break; |
419 | 419 | } |
420 | 420 | } |
421 | 421 | |
422 | - if ($result->getNextPage()==null) |
|
422 | + if ($result->getNextPage() == null) |
|
423 | 423 | break; |
424 | 424 | |
425 | - $page ++; |
|
425 | + $page++; |
|
426 | 426 | } |
427 | 427 | } |
428 | 428 | catch (Exception $e) { |
@@ -440,14 +440,14 @@ discard block |
||
440 | 440 | try { |
441 | 441 | $result = $optimizelyClient->projects()->get(12345678); |
442 | 442 | } |
443 | - catch(Exception $e) { |
|
443 | + catch (Exception $e) { |
|
444 | 444 | //print_r($optimizelyClient->getDiagnosticsInfo()); |
445 | 445 | $this->assertEquals(Exception::CODE_API_ERROR, $e->getCode()); |
446 | 446 | $this->assertEquals('not_found', $e->getHttpCode()); |
447 | - $this->assertTrue(strlen($e->getUuid())!=0); |
|
448 | - $this->assertTrue($e->getRateLimit()>0); |
|
449 | - $this->assertTrue($e->getRateLimitRemaining()>0); |
|
450 | - $this->assertTrue($e->getRateLimitReset()>0); |
|
447 | + $this->assertTrue(strlen($e->getUuid()) != 0); |
|
448 | + $this->assertTrue($e->getRateLimit() > 0); |
|
449 | + $this->assertTrue($e->getRateLimitRemaining() > 0); |
|
450 | + $this->assertTrue($e->getRateLimitReset() > 0); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | // Retrieve existing project by ID |
@@ -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 |
@@ -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"; |