@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | use WebMarketingROI\OptimizelyPHP\Resource\v2\Project; |
18 | 18 | |
19 | 19 | // Init class autloading. |
20 | -include dirname(__FILE__) . '/../../vendor/autoload.php'; |
|
20 | +include dirname(__FILE__).'/../../vendor/autoload.php'; |
|
21 | 21 | |
22 | 22 | // Include Utils.php - a file containing helper functions |
23 | -include dirname(__FILE__) . '/../Utils.php'; |
|
23 | +include dirname(__FILE__).'/../Utils.php'; |
|
24 | 24 | |
25 | 25 | // Read project ID from command line. |
26 | -if ($argc!=2) { |
|
27 | - die('Expected 1 command-line argument, while got ' . $argc-1); |
|
26 | +if ($argc != 2) { |
|
27 | + die('Expected 1 command-line argument, while got '.$argc - 1); |
|
28 | 28 | } |
29 | 29 | $projectId = $argv[1]; |
30 | 30 | |
@@ -56,6 +56,6 @@ discard block |
||
56 | 56 | |
57 | 57 | // Save access token for later use |
58 | 58 | $accessToken = $optimizelyClient->getAccessToken(); |
59 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
59 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
60 | 60 | |
61 | 61 | echo "Done!\n"; |
62 | 62 | \ No newline at end of file |
@@ -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: " . $project->getStatus() . "\n"; |
|
53 | - echo "Created: " . $project->getCreated() . "\n"; |
|
50 | + echo "Name: ".$experiment->getName()."\n"; |
|
51 | + echo "Description: ".$experiment->getDescription()."\n"; |
|
52 | + echo "Status: ".$project->getStatus()."\n"; |
|
53 | + echo "Created: ".$project->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"; |
@@ -56,8 +56,9 @@ |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | // Determine if there are more projects. |
59 | - if ($result->getNextPage()==null) |
|
60 | - break; |
|
59 | + if ($result->getNextPage()==null) { |
|
60 | + break; |
|
61 | + } |
|
61 | 62 | |
62 | 63 | // Increment page counter. |
63 | 64 | $page ++; |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | * @return Result |
35 | 35 | * @throws Exception |
36 | 36 | */ |
37 | - public function listAll($page=1, $perPage=25) |
|
37 | + public function listAll($page = 1, $perPage = 25) |
|
38 | 38 | { |
39 | - if ($page<0) { |
|
39 | + if ($page < 0) { |
|
40 | 40 | throw new Exception('Invalid page number passed'); |
41 | 41 | } |
42 | 42 | |
43 | - if ($perPage<0 || $perPage>100) { |
|
43 | + if ($perPage < 0 || $perPage > 100) { |
|
44 | 44 | throw new Exception('Invalid page size passed'); |
45 | 45 | } |
46 | 46 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | throw new Exception("Integer project ID expected, while got '$projectId'"); |
73 | 73 | } |
74 | 74 | |
75 | - if ($projectId<0) { |
|
75 | + if ($projectId < 0) { |
|
76 | 76 | throw new Exception("A positive project ID expected"); |
77 | 77 | } |
78 | 78 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | throw new Exception("Integer project ID expected, while got '$projectId'"); |
120 | 120 | } |
121 | 121 | |
122 | - if ($projectId<0) { |
|
122 | + if ($projectId < 0) { |
|
123 | 123 | throw new Exception("A positive project ID expected"); |
124 | 124 | } |
125 | 125 |
@@ -38,14 +38,14 @@ |
||
38 | 38 | * @return Result |
39 | 39 | * @throws Exception |
40 | 40 | */ |
41 | - public function listAll($projectId, $includeClassic, $page=1, $perPage=25) |
|
41 | + public function listAll($projectId, $includeClassic, $page = 1, $perPage = 25) |
|
42 | 42 | { |
43 | - if ($page<0) { |
|
43 | + if ($page < 0) { |
|
44 | 44 | throw new Exception('Invalid page number passed', |
45 | 45 | Exception::CODE_INVALID_ARG); |
46 | 46 | } |
47 | 47 | |
48 | - if ($perPage<0) { |
|
48 | + if ($perPage < 0) { |
|
49 | 49 | throw new Exception('Invalid page size passed', |
50 | 50 | Exception::CODE_INVALID_ARG); |
51 | 51 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @return Result |
39 | 39 | * @throws Exception |
40 | 40 | */ |
41 | - public function listAll($projectId, $campaignId=null, $includeClassic=false, $page=1, $perPage=25) |
|
41 | + public function listAll($projectId, $campaignId = null, $includeClassic = false, $page = 1, $perPage = 25) |
|
42 | 42 | { |
43 | 43 | if (empty($projectId) && empty($campaignId)) { |
44 | 44 | throw new Exception('Project ID or Campaign ID must be non-empty', |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | throw new Exception("Expected argument of type Experiment"); |
164 | 164 | } |
165 | 165 | |
166 | - if ($experimentId<0) { |
|
166 | + if ($experimentId < 0) { |
|
167 | 167 | throw new Exception("Expected positive experiment ID argument"); |
168 | 168 | } |
169 | 169 |
@@ -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) { |
|
45 | + if ($perPage < 0) { |
|
46 | 46 | throw new Exception('Invalid page size passed'); |
47 | 47 | } |
48 | 48 |
@@ -74,7 +74,7 @@ |
||
74 | 74 | case 'unit': $this->setUnit($value); break; |
75 | 75 | case 'variation_results': $this->setVariationResults($value); break; |
76 | 76 | default: |
77 | - throw new Exception('Unknown option: ' . $name); |
|
77 | + throw new Exception('Unknown option: '.$name); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | } |
@@ -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) { |
|
45 | + if ($perPage < 0) { |
|
46 | 46 | throw new Exception('Invalid page size passed'); |
47 | 47 | } |
48 | 48 |