@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | case 'is_classic': $this->setIsClassic($value); break; |
124 | 124 | case 'is_editable': $this->setIsEditable($value); break; |
125 | 125 | default: |
126 | - throw new \Exception('Unknown option: ' . $name); |
|
126 | + throw new \Exception('Unknown option: '.$name); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | 'category' => $this->getCategory(), |
140 | 140 | 'created' => $this->getCreated(), |
141 | 141 | 'description' => $this->getDescription(), |
142 | - 'event_filter' => $this->getEventFilter()?$this->getEventFilter()->toArray():null, |
|
142 | + 'event_filter' => $this->getEventFilter() ? $this->getEventFilter()->toArray() : null, |
|
143 | 143 | 'event_type' => $this->getEventType(), |
144 | 144 | 'key' => $this->getKey(), |
145 | 145 | 'name' => $this->getName(), |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | // Remove options with empty values |
154 | 154 | $cleanedOptions = array(); |
155 | 155 | foreach ($options as $name=>$value) { |
156 | - if ($value!==null) |
|
156 | + if ($value !== null) |
|
157 | 157 | $cleanedOptions[$name] = $value; |
158 | 158 | } |
159 | 159 |
@@ -51,8 +51,9 @@ |
||
51 | 51 | // Remove options with empty values |
52 | 52 | $cleanedOptions = array(); |
53 | 53 | foreach ($options as $name=>$value) { |
54 | - if ($value!==null) |
|
55 | - $cleanedOptions[$name] = $value; |
|
54 | + if ($value!==null) { |
|
55 | + $cleanedOptions[$name] = $value; |
|
56 | + } |
|
56 | 57 | } |
57 | 58 | |
58 | 59 | return $cleanedOptions; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | case 'last_modified': $this->setLastModified($value); break; |
115 | 115 | case 'socket_token': $this->setSocketToken($value); break; |
116 | 116 | default: |
117 | - throw new \Exception('Unknown option: ' . $name); |
|
117 | + throw new \Exception('Unknown option: '.$name); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | 'dcp_service_id' => $this->getDcpServiceId(), |
132 | 132 | 'platform' => $this->getPlatform(), |
133 | 133 | 'status' => $this->getStatus(), |
134 | - 'web_snippet' => $this->getWebSnippet()?$this->getWebSnippet()->toArray():null, |
|
134 | + 'web_snippet' => $this->getWebSnippet() ? $this->getWebSnippet()->toArray() : null, |
|
135 | 135 | 'created' => $this->getCreated(), |
136 | 136 | 'id' => $this->getId(), |
137 | 137 | 'is_classic' => $this->getIsClassic(), |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | // Remove options with empty values |
143 | 143 | $cleanedOptions = array(); |
144 | 144 | foreach ($options as $name=>$value) { |
145 | - if ($value!==null) |
|
145 | + if ($value !== null) |
|
146 | 146 | $cleanedOptions[$name] = $value; |
147 | 147 | } |
148 | 148 |
@@ -51,8 +51,9 @@ |
||
51 | 51 | // Remove options with empty values |
52 | 52 | $cleanedOptions = array(); |
53 | 53 | foreach ($options as $name=>$value) { |
54 | - if ($value!==null) |
|
55 | - $cleanedOptions[$name] = $value; |
|
54 | + if ($value!==null) { |
|
55 | + $cleanedOptions[$name] = $value; |
|
56 | + } |
|
56 | 57 | } |
57 | 58 | |
58 | 59 | return $cleanedOptions; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | case 'reach': $this->setReach(new ExperimentVariationReach($value)); break; |
75 | 75 | case 'start_time': $this->setStartTime($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 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | 'end_time' => $this->getEndTime(), |
90 | 90 | 'experiment_id' => $this->getExperimentId(), |
91 | 91 | 'metrics' => array(), |
92 | - 'reach' => $this->getReach()?$this->getReach()->toArray():null, |
|
92 | + 'reach' => $this->getReach() ? $this->getReach()->toArray() : null, |
|
93 | 93 | 'start_time' => $this->getStartTime() |
94 | 94 | ); |
95 | 95 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | // Remove options with empty values |
101 | 101 | $cleanedOptions = array(); |
102 | 102 | foreach ($options as $name=>$value) { |
103 | - if ($value!==null) |
|
103 | + if ($value !== null) |
|
104 | 104 | $cleanedOptions[$name] = $value; |
105 | 105 | } |
106 | 106 |
@@ -51,8 +51,9 @@ |
||
51 | 51 | // Remove options with empty values |
52 | 52 | $cleanedOptions = array(); |
53 | 53 | foreach ($options as $name=>$value) { |
54 | - if ($value!==null) |
|
55 | - $cleanedOptions[$name] = $value; |
|
54 | + if ($value!==null) { |
|
55 | + $cleanedOptions[$name] = $value; |
|
56 | + } |
|
56 | 57 | } |
57 | 58 | |
58 | 59 | return $cleanedOptions; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | case 'id': $this->setId($value); break; |
161 | 161 | case 'is_classic': $this->setIsClassic($value); break; |
162 | 162 | default: |
163 | - throw new \Exception('Unknown option: ' . $name); |
|
163 | + throw new \Exception('Unknown option: '.$name); |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | 'last_modified' => $this->getLastModified(), |
183 | 183 | 'metrics' => array(), |
184 | 184 | 'name' => $this->getName(), |
185 | - 'schedule' => $this->getSchedule()?$this->getSchedule()->toArray():null, |
|
185 | + 'schedule' => $this->getSchedule() ? $this->getSchedule()->toArray() : null, |
|
186 | 186 | 'status' => $this->getStatus(), |
187 | 187 | 'variations' => array(), |
188 | 188 | 'id' => $this->getId(), |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | // Remove options with empty values |
205 | 205 | $cleanedOptions = array(); |
206 | 206 | foreach ($options as $name=>$value) { |
207 | - if ($value!==null) |
|
207 | + if ($value !== null) |
|
208 | 208 | $cleanedOptions[$name] = $value; |
209 | 209 | } |
210 | 210 |
@@ -51,8 +51,9 @@ |
||
51 | 51 | // Remove options with empty values |
52 | 52 | $cleanedOptions = array(); |
53 | 53 | foreach ($options as $name=>$value) { |
54 | - if ($value!==null) |
|
55 | - $cleanedOptions[$name] = $value; |
|
54 | + if ($value!==null) { |
|
55 | + $cleanedOptions[$name] = $value; |
|
56 | + } |
|
56 | 57 | } |
57 | 58 | |
58 | 59 | return $cleanedOptions; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | case 'kind': $this->setKind($value); break; |
34 | 34 | case 'id': $this->setId($value); break; |
35 | 35 | default: |
36 | - throw new \Exception('Unknown option: ' . $name); |
|
36 | + throw new \Exception('Unknown option: '.$name); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | // Remove options with empty values |
52 | 52 | $cleanedOptions = array(); |
53 | 53 | foreach ($options as $name=>$value) { |
54 | - if ($value!==null) |
|
54 | + if ($value !== null) |
|
55 | 55 | $cleanedOptions[$name] = $value; |
56 | 56 | } |
57 | 57 |
@@ -51,8 +51,9 @@ |
||
51 | 51 | // Remove options with empty values |
52 | 52 | $cleanedOptions = array(); |
53 | 53 | foreach ($options as $name=>$value) { |
54 | - if ($value!==null) |
|
55 | - $cleanedOptions[$name] = $value; |
|
54 | + if ($value!==null) { |
|
55 | + $cleanedOptions[$name] = $value; |
|
56 | + } |
|
56 | 57 | } |
57 | 58 | |
58 | 59 | return $cleanedOptions; |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | use WebMarketingROI\OptimizelyPHP\Resource\v2\Project; |
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 | |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | $createdProject = $optimizelyClient->projects()->create($project); |
45 | 45 | |
46 | 46 | } catch (\Exception $e) { |
47 | - echo "Exception caught: " . $e->getMessage() . "\n"; |
|
47 | + echo "Exception caught: ".$e->getMessage()."\n"; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | // Save access token for later use |
51 | 51 | $accessToken = $optimizelyClient->getAccessToken(); |
52 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
52 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
53 | 53 | |
54 | 54 | echo "Done!\n"; |
55 | 55 | \ No newline at end of file |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | use WebMarketingROI\OptimizelyPHP\OptimizelyApiClient; |
16 | 16 | |
17 | 17 | // Init class autloading. |
18 | -include dirname(__FILE__) . '/../../vendor/autoload.php'; |
|
18 | +include dirname(__FILE__).'/../../vendor/autoload.php'; |
|
19 | 19 | |
20 | 20 | // Include Utils.php - a file containing helper functions |
21 | -include dirname(__FILE__) . '/../Utils.php'; |
|
21 | +include dirname(__FILE__).'/../Utils.php'; |
|
22 | 22 | |
23 | 23 | // Get OAuth 2.0 credentials from auth_credentials.json and access_token.json files. |
24 | 24 | $credentials = load_credentials_from_file(); |
@@ -39,28 +39,28 @@ discard block |
||
39 | 39 | $projects = $optimizelyClient->projects()->listAll($page, $perPage); |
40 | 40 | |
41 | 41 | foreach ($projects as $project) { |
42 | - echo "ID: " . $project->getId() . "\n"; |
|
43 | - echo "Name: " . $project->getName() . "\n"; |
|
44 | - echo "Account ID: " . $project->getAccountId() . "\n"; |
|
45 | - echo "Platform: " . $project->getPlatform() . "\n"; |
|
46 | - echo "Status: " . $project->getStatus() . "\n"; |
|
47 | - echo "Is Classic: " . ($project->getIsClassic()?"true":"false") . "\n"; |
|
48 | - echo "Created: " . $project->getCreated() . "\n"; |
|
49 | - echo "Last Modified: " . $project->getLastModified() . "\n"; |
|
42 | + echo "ID: ".$project->getId()."\n"; |
|
43 | + echo "Name: ".$project->getName()."\n"; |
|
44 | + echo "Account ID: ".$project->getAccountId()."\n"; |
|
45 | + echo "Platform: ".$project->getPlatform()."\n"; |
|
46 | + echo "Status: ".$project->getStatus()."\n"; |
|
47 | + echo "Is Classic: ".($project->getIsClassic() ? "true" : "false")."\n"; |
|
48 | + echo "Created: ".$project->getCreated()."\n"; |
|
49 | + echo "Last Modified: ".$project->getLastModified()."\n"; |
|
50 | 50 | |
51 | 51 | echo "\n"; |
52 | 52 | } |
53 | 53 | |
54 | 54 | } catch (\Exception $e) { |
55 | - echo "Exception caught: " . $e->getMessage() . "\n"; |
|
55 | + echo "Exception caught: ".$e->getMessage()."\n"; |
|
56 | 56 | break; |
57 | 57 | } |
58 | 58 | |
59 | - $page ++; |
|
59 | + $page++; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // Save access token for later use |
63 | 63 | $accessToken = $optimizelyClient->getAccessToken(); |
64 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
64 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
65 | 65 | |
66 | 66 | echo "Done!\n"; |
67 | 67 | \ No newline at end of file |
@@ -9,7 +9,7 @@ |
||
9 | 9 | $credentials = file_get_contents(dirname(__FILE__) . '/auth_credentials.json'); |
10 | 10 | if ($credentials===false) { |
11 | 11 | die ("Couldn't read OAuth credentials from auth_credentials.json. Make sure " . |
12 | - "the file exists (if not, copy from auth_credentials.json.dist)."); |
|
12 | + "the file exists (if not, copy from auth_credentials.json.dist)."); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | $credentials = json_decode($credentials, true); |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | function load_credentials_from_file() |
14 | 14 | { |
15 | 15 | // Get OAuth 2.0 credentials from auth_credentials.json file. |
16 | - $credentials = file_get_contents(dirname(__FILE__) . '/auth_credentials.json'); |
|
17 | - if ($credentials===false) { |
|
18 | - throw new \Exception("Couldn't read OAuth credentials from auth_credentials.json. Make sure " . |
|
16 | + $credentials = file_get_contents(dirname(__FILE__).'/auth_credentials.json'); |
|
17 | + if ($credentials === false) { |
|
18 | + throw new \Exception("Couldn't read OAuth credentials from auth_credentials.json. Make sure ". |
|
19 | 19 | "the file exists (if not, copy from auth_credentials.json.dist)."); |
20 | 20 | } |
21 | 21 | |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | // Try to read access_token.json and merge it with the rest of credentials. |
28 | - if (is_readable(dirname(__FILE__) . '/access_token.json')) { |
|
29 | - $accessToken = file_get_contents(dirname(__FILE__) . '/access_token.json'); |
|
28 | + if (is_readable(dirname(__FILE__).'/access_token.json')) { |
|
29 | + $accessToken = file_get_contents(dirname(__FILE__).'/access_token.json'); |
|
30 | 30 | |
31 | 31 | $accessToken = json_decode($accessToken, true); |
32 | 32 | if (!is_array($accessToken)) { |
@@ -15,14 +15,14 @@ discard block |
||
15 | 15 | use WebMarketingROI\OptimizelyPHP\OptimizelyApiClient; |
16 | 16 | |
17 | 17 | // Init class autloading. |
18 | -include dirname(__FILE__) . '/../../vendor/autoload.php'; |
|
18 | +include dirname(__FILE__).'/../../vendor/autoload.php'; |
|
19 | 19 | |
20 | 20 | // Include Utils.php - a file containing helper functions |
21 | -include dirname(__FILE__) . '/../Utils.php'; |
|
21 | +include dirname(__FILE__).'/../Utils.php'; |
|
22 | 22 | |
23 | 23 | // Read project ID from command line. |
24 | -if ($argc!=2) { |
|
25 | - die('Expected 1 command-line argument, while got ' . $argc-1); |
|
24 | +if ($argc != 2) { |
|
25 | + die('Expected 1 command-line argument, while got '.$argc - 1); |
|
26 | 26 | } |
27 | 27 | $projectId = $argv[1]; |
28 | 28 | |
@@ -45,24 +45,24 @@ discard block |
||
45 | 45 | $experiments = $optimizelyClient->experiments()->listAll($projectId, null, true, $page, $perPage); |
46 | 46 | |
47 | 47 | foreach ($experiments as $experiment) { |
48 | - echo "Name: " . $experiment->getName() . "\n"; |
|
49 | - echo "Description: " . $experiment->getDescription() . "\n"; |
|
50 | - echo "Status: " . $project->getStatus() . "\n"; |
|
51 | - echo "Created: " . $project->getCreated() . "\n"; |
|
48 | + echo "Name: ".$experiment->getName()."\n"; |
|
49 | + echo "Description: ".$experiment->getDescription()."\n"; |
|
50 | + echo "Status: ".$project->getStatus()."\n"; |
|
51 | + echo "Created: ".$project->getCreated()."\n"; |
|
52 | 52 | |
53 | 53 | echo "\n"; |
54 | 54 | } |
55 | 55 | |
56 | 56 | } catch (\Exception $e) { |
57 | - echo "Exception caught: " . $e->getMessage() . "\n"; |
|
57 | + echo "Exception caught: ".$e->getMessage()."\n"; |
|
58 | 58 | break; |
59 | 59 | } |
60 | 60 | |
61 | - $page ++; |
|
61 | + $page++; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | // Save access token for later use |
65 | 65 | $accessToken = $optimizelyClient->getAccessToken(); |
66 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
66 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
67 | 67 | |
68 | 68 | echo "Done!\n"; |