Completed
Branch develop (dc0792)
by James
04:21 queued 01:18
created
examples/Projects/GetProjects.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
examples/Utils.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@  discard block
 block discarded – undo
6 6
 function load_credentials_from_file()
7 7
 {
8 8
     // Get OAuth 2.0 credentials from auth_credentials.json file.
9
-    $credentials = file_get_contents(dirname(__FILE__) . '/auth_credentials.json');
10
-    if ($credentials===false) {
11
-        die ("Couldn't read OAuth credentials from auth_credentials.json. Make sure " .
9
+    $credentials = file_get_contents(dirname(__FILE__).'/auth_credentials.json');
10
+    if ($credentials === false) {
11
+        die ("Couldn't read OAuth credentials from auth_credentials.json. Make sure ".
12 12
              "the file exists (if not, copy from auth_credentials.json.dist).");
13 13
     }
14 14
 
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
     }
19 19
 
20 20
     // Try to read access_token.json and merge it with the rest of credentials.
21
-    if (is_readable(dirname(__FILE__) . '/access_token.json')) {
22
-        $accessToken = file_get_contents(dirname(__FILE__) . '/access_token.json');
21
+    if (is_readable(dirname(__FILE__).'/access_token.json')) {
22
+        $accessToken = file_get_contents(dirname(__FILE__).'/access_token.json');
23 23
 
24 24
         $accessToken = json_decode($accessToken, true);
25 25
         if (!is_array($accessToken)) {
Please login to merge, or discard this patch.
examples/Experiments/GetExperiments.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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";
Please login to merge, or discard this patch.
tests/OptimizelyPHPTest/Service/v2/EventsTest.php 2 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
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",
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
                             "category" => "add_to_cart",
62 62
                             "description" => "Item added to cart",
63 63
                             "event_filter" => array(
64
-                              "filter_type" => "target_selector",
65
-                              "selector" => ".menu-options"
64
+                                "filter_type" => "target_selector",
65
+                                "selector" => ".menu-options"
66 66
                             ),
67 67
                             "event_type" => "custom",
68 68
                             "key" => "add_to_cart",
@@ -92,37 +92,37 @@  discard block
 block discarded – undo
92 92
 
93 93
         $optimizelyApiClientMock->method('sendApiRequest')
94 94
                     ->willReturn(array(
95
-                              "event_filter" => array(
95
+                                "event_filter" => array(
96 96
                                 "filter_type" => "target_selector",
97 97
                                 "selector" => ".menu-options"
98
-                              ),
99
-                              "name" => "Add to Cart",
100
-                              "archived" => true,
101
-                              "category" => "add_to_cart",
102
-                              "description" => "string",
103
-                              "event_type" => "click",
104
-                              "key" => "add_to_cart",
105
-                              "created" => "2016-10-18T05:07:04.153Z",
106
-                              "id" => 0,
107
-                              "is_classic" => false,
108
-                              "is_editable" => true,
109
-                              "page_id" => 0,
110
-                              "project_id" => 1000
98
+                                ),
99
+                                "name" => "Add to Cart",
100
+                                "archived" => true,
101
+                                "category" => "add_to_cart",
102
+                                "description" => "string",
103
+                                "event_type" => "click",
104
+                                "key" => "add_to_cart",
105
+                                "created" => "2016-10-18T05:07:04.153Z",
106
+                                "id" => 0,
107
+                                "is_classic" => false,
108
+                                "is_editable" => true,
109
+                                "page_id" => 0,
110
+                                "project_id" => 1000
111 111
                         ));
112 112
         
113 113
         $eventsService = new Events($optimizelyApiClientMock);
114 114
         
115 115
         $event = new ClickEvent(array(
116
-              "event_filter" => array(
116
+                "event_filter" => array(
117 117
                 "filter_type" => "target_selector",
118 118
                 "selector" => ".menu-options"
119
-              ),
120
-              "name" => "Add to Cart",
121
-              "archived" => true,
122
-              "category" => "add_to_cart",
123
-              "description" => "string",
124
-              "event_type" => "click",
125
-              "key" => "add_to_cart"
119
+                ),
120
+                "name" => "Add to Cart",
121
+                "archived" => true,
122
+                "category" => "add_to_cart",
123
+                "description" => "string",
124
+                "event_type" => "click",
125
+                "key" => "add_to_cart"
126 126
         ));
127 127
         
128 128
         $createdEvent = $eventsService->createClickEvent(0, $event);
@@ -180,37 +180,37 @@  discard block
 block discarded – undo
180 180
 
181 181
         $optimizelyApiClientMock->method('sendApiRequest')
182 182
                     ->willReturn(array(
183
-                              "event_filter" => array(
183
+                                "event_filter" => array(
184 184
                                 "filter_type" => "target_selector",
185 185
                                 "selector" => ".menu-options"
186
-                              ),
187
-                              "name" => "Add to Cart",
188
-                              "archived" => true,
189
-                              "category" => "add_to_cart",
190
-                              "description" => "string",
191
-                              "event_type" => "click",
192
-                              "key" => "add_to_cart",
193
-                              "created" => "2016-10-18T05:07:04.153Z",
194
-                              "id" => 0,
195
-                              "is_classic" => false,
196
-                              "is_editable" => true,
197
-                              "page_id" => 0,
198
-                              "project_id" => 1000
186
+                                ),
187
+                                "name" => "Add to Cart",
188
+                                "archived" => true,
189
+                                "category" => "add_to_cart",
190
+                                "description" => "string",
191
+                                "event_type" => "click",
192
+                                "key" => "add_to_cart",
193
+                                "created" => "2016-10-18T05:07:04.153Z",
194
+                                "id" => 0,
195
+                                "is_classic" => false,
196
+                                "is_editable" => true,
197
+                                "page_id" => 0,
198
+                                "project_id" => 1000
199 199
                         ));
200 200
         
201 201
         $eventsService = new Events($optimizelyApiClientMock);
202 202
         
203 203
         $event = new ClickEvent(array(
204
-              "event_filter" => array(
204
+                "event_filter" => array(
205 205
                 "filter_type" => "target_selector",
206 206
                 "selector" => ".menu-options"
207
-              ),
208
-              "name" => "Add to Cart",
209
-              "archived" => true,
210
-              "category" => "add_to_cart",
211
-              "description" => "string",
212
-              "event_type" => "click",
213
-              "key" => "add_to_cart"
207
+                ),
208
+                "name" => "Add to Cart",
209
+                "archived" => true,
210
+                "category" => "add_to_cart",
211
+                "description" => "string",
212
+                "event_type" => "click",
213
+                "key" => "add_to_cart"
214 214
         ));
215 215
         
216 216
         $updatedEvent = $eventsService->updateClickEvent(0, 0, $event);
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
         
44 44
         $events = $eventsService->listAll(1000, true);
45 45
         
46
-        $this->assertTrue(count($events)==1);
46
+        $this->assertTrue(count($events) == 1);
47 47
         $this->assertTrue($events[0] instanceOf Event);
48
-        $this->assertTrue($events[0]->getName()=='Add to Cart');        
48
+        $this->assertTrue($events[0]->getName() == 'Add to Cart');        
49 49
     }
50 50
     
51 51
     public function testGet()
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         $event = $eventsService->get(5000);
81 81
         
82 82
         $this->assertTrue($event instanceOf Event);
83
-        $this->assertTrue($event->getName()=='Add to Cart');        
83
+        $this->assertTrue($event->getName() == 'Add to Cart');        
84 84
     }
85 85
     
86 86
     public function testCreateClickEvent()
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         $createdEvent = $eventsService->createClickEvent(0, $event);
129 129
         
130 130
         $this->assertTrue($createdEvent instanceOf ClickEvent);
131
-        $this->assertTrue($createdEvent->getName()=='Add to Cart');                
131
+        $this->assertTrue($createdEvent->getName() == 'Add to Cart');                
132 132
     }
133 133
     
134 134
     public function testCreateCustomEvent()
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         $createdEvent = $eventsService->createCustomEvent(0, $event);
169 169
         
170 170
         $this->assertTrue($createdEvent instanceOf CustomEvent);
171
-        $this->assertTrue($createdEvent->getName()=='Loaded New App');                
171
+        $this->assertTrue($createdEvent->getName() == 'Loaded New App');                
172 172
     }
173 173
     
174 174
     public function testUpdateClickEvent()
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
         $updatedEvent = $eventsService->updateClickEvent(0, 0, $event);
217 217
         
218 218
         $this->assertTrue($updatedEvent instanceOf ClickEvent);
219
-        $this->assertTrue($updatedEvent->getName()=='Add to Cart');                
219
+        $this->assertTrue($updatedEvent->getName() == 'Add to Cart');                
220 220
     }
221 221
     
222 222
     public function testUpdateCustomEvent()
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         $updatedEvent = $eventsService->updateCustomEvent(0, 0, $event);
257 257
         
258 258
         $this->assertTrue($updatedEvent instanceOf CustomEvent);
259
-        $this->assertTrue($updatedEvent->getName()=='Loaded New App');                
259
+        $this->assertTrue($updatedEvent->getName() == 'Loaded New App');                
260 260
     }
261 261
 }
262 262
 
Please login to merge, or discard this patch.
tests/OptimizelyPHPTest/Service/v2/AudiencesTest.php 2 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -21,15 +21,15 @@  discard block
 block discarded – undo
21 21
                             "project_id" => 1000,
22 22
                             "archived" => false,
23 23
                             "conditions" => array(
24
-                              "and",
25
-                              array(
24
+                                "and",
25
+                                array(
26 26
                                 "type" => "language",
27 27
                                 "value" => "es"
28
-                              ),
29
-                              array(
28
+                                ),
29
+                                array(
30 30
                                 "type" => "location",
31 31
                                 "value" => "US-CA-SANFRANCISCO"
32
-                              )
32
+                                )
33 33
                             ),
34 34
                             "description" => "People that speak spanish and are in San Francisco",
35 35
                             "name" => "Spanish speaking San Franciscans",
@@ -61,15 +61,15 @@  discard block
 block discarded – undo
61 61
                             "project_id" => 1000,
62 62
                             "archived" => false,
63 63
                             "conditions" => array(
64
-                              "and",
65
-                              array(
64
+                                "and",
65
+                                array(
66 66
                                 "type" => "language",
67 67
                                 "value" => "es"
68
-                              ),
69
-                              array(
68
+                                ),
69
+                                array(
70 70
                                 "type" => "location",
71 71
                                 "value" => "US-CA-SANFRANCISCO"
72
-                              )
72
+                                )
73 73
                             ),
74 74
                             "description" => "People that speak spanish and are in San Francisco",
75 75
                             "name" => "Spanish speaking San Franciscans",
@@ -99,15 +99,15 @@  discard block
 block discarded – undo
99 99
                             "project_id" => 1000,
100 100
                             "archived" => false,
101 101
                             "conditions" => array(
102
-                              "and",
103
-                              array(
102
+                                "and",
103
+                                array(
104 104
                                 "type" => "language",
105 105
                                 "value" => "es"
106
-                              ),
107
-                              array(
106
+                                ),
107
+                                array(
108 108
                                 "type" => "location",
109 109
                                 "value" => "US-CA-SANFRANCISCO"
110
-                              )
110
+                                )
111 111
                             ),
112 112
                             "description" => "People that speak spanish and are in San Francisco",
113 113
                             "name" => "Spanish speaking San Franciscans",
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
                 "project_id" => 1000,
124 124
                 "archived" => false,
125 125
                 "conditions" => array(
126
-                  "and",
127
-                  array(
126
+                    "and",
127
+                    array(
128 128
                     "type" => "language",
129 129
                     "value" => "es"
130
-                  ),
131
-                  array(
130
+                    ),
131
+                    array(
132 132
                     "type" => "location",
133 133
                     "value" => "US-CA-SANFRANCISCO"
134
-                  )
134
+                    )
135 135
                 ),
136 136
                 "description" => "People that speak spanish and are in San Francisco",
137 137
                 "name" => "Spanish speaking San Franciscans",
@@ -156,15 +156,15 @@  discard block
 block discarded – undo
156 156
                             "project_id" => 1000,
157 157
                             "archived" => false,
158 158
                             "conditions" => array(
159
-                              "and",
160
-                              array(
159
+                                "and",
160
+                                array(
161 161
                                 "type" => "language",
162 162
                                 "value" => "es"
163
-                              ),
164
-                              array(
163
+                                ),
164
+                                array(
165 165
                                 "type" => "location",
166 166
                                 "value" => "US-CA-SANFRANCISCO"
167
-                              )
167
+                                )
168 168
                             ),
169 169
                             "description" => "People that speak spanish and are in San Francisco",
170 170
                             "name" => "Spanish speaking San Franciscans",
@@ -180,15 +180,15 @@  discard block
 block discarded – undo
180 180
                 "project_id" => 1000,
181 181
                 "archived" => false,
182 182
                 "conditions" => array(
183
-                  "and",
184
-                  array(
183
+                    "and",
184
+                    array(
185 185
                     "type" => "language",
186 186
                     "value" => "es"
187
-                  ),
188
-                  array(
187
+                    ),
188
+                    array(
189 189
                     "type" => "location",
190 190
                     "value" => "US-CA-SANFRANCISCO"
191
-                  )
191
+                    )
192 192
                 ),
193 193
                 "description" => "People that speak spanish and are in San Francisco",
194 194
                 "name" => "Spanish speaking San Franciscans",
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
         
45 45
         $audiences = $audiencesService->listAll(1000);
46 46
         
47
-        $this->assertTrue(count($audiences)==1);
47
+        $this->assertTrue(count($audiences) == 1);
48 48
         $this->assertTrue($audiences[0] instanceOf Audience);
49
-        $this->assertTrue($audiences[0]->getName()=='Spanish speaking San Franciscans');        
49
+        $this->assertTrue($audiences[0]->getName() == 'Spanish speaking San Franciscans');        
50 50
     }
51 51
     
52 52
     public function testGet()
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         $audience = $audiencesService->get(5000);
85 85
         
86 86
         $this->assertTrue($audience instanceOf Audience);
87
-        $this->assertTrue($audience->getName()=='Spanish speaking San Franciscans');        
87
+        $this->assertTrue($audience->getName() == 'Spanish speaking San Franciscans');        
88 88
     }
89 89
     
90 90
     public function testCreate()
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $createdAudience = $audiencesService->create($audience);
142 142
         
143 143
         $this->assertTrue($createdAudience instanceOf Audience);
144
-        $this->assertTrue($createdAudience->getName()=='Spanish speaking San Franciscans');                
144
+        $this->assertTrue($createdAudience->getName() == 'Spanish speaking San Franciscans');                
145 145
     }
146 146
     
147 147
     public function testUpdate()
@@ -198,6 +198,6 @@  discard block
 block discarded – undo
198 198
         $createdAudience = $audiencesService->update(5000, $audience);
199 199
         
200 200
         $this->assertTrue($createdAudience instanceOf Audience);
201
-        $this->assertTrue($createdAudience->getName()=='Spanish speaking San Franciscans');                
201
+        $this->assertTrue($createdAudience->getName() == 'Spanish speaking San Franciscans');                
202 202
     }
203 203
 }
204 204
\ No newline at end of file
Please login to merge, or discard this patch.
tests/OptimizelyPHPTest/Service/v2/PagesTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
         
39 39
         $pages = $pagesService->listAll(1000);
40 40
         
41
-        $this->assertTrue(count($pages)==1);
41
+        $this->assertTrue(count($pages) == 1);
42 42
         $this->assertTrue($pages[0] instanceOf Page);
43
-        $this->assertTrue($pages[0]->getName()=='Home Page');        
43
+        $this->assertTrue($pages[0]->getName() == 'Home Page');        
44 44
     }
45 45
     
46 46
     public function testGet()
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         $page = $pagesService->get(5000);
73 73
         
74 74
         $this->assertTrue($page instanceOf Page);
75
-        $this->assertTrue($page->getName()=='Home Page');        
75
+        $this->assertTrue($page->getName() == 'Home Page');        
76 76
     }
77 77
     
78 78
     public function testCreate()
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         $createdPage = $pagesService->create($page);
118 118
         
119 119
         $this->assertTrue($createdPage instanceOf Page);
120
-        $this->assertTrue($createdPage->getName()=='Home Page');                
120
+        $this->assertTrue($createdPage->getName() == 'Home Page');                
121 121
     }
122 122
     
123 123
     public function testUpdate()
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
         $updatedPage = $pagesService->update(1000, $page);
163 163
         
164 164
         $this->assertTrue($updatedPage instanceOf Page);
165
-        $this->assertTrue($updatedPage->getName()=='Home Page');                  
165
+        $this->assertTrue($updatedPage->getName() == 'Home Page');                  
166 166
     }
167 167
     
168 168
     public function testDelete()
Please login to merge, or discard this patch.
tests/OptimizelyPHPTest/Service/v2/ExperimentsTest.php 2 patches
Indentation   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -23,20 +23,20 @@  discard block
 block discarded – undo
23 23
                         array(
24 24
                             "project_id" => 1000,
25 25
                             "audience_ids" => array(
26
-                              1234,
27
-                              1212,
28
-                              1432
26
+                                1234,
27
+                                1212,
28
+                                1432
29 29
                             ),
30 30
                             "campaign_id" => 2000,
31 31
                             "changes" => array(
32
-                              array(
32
+                                array(
33 33
                                 "type" => "custom_code",
34 34
                                 "allow_additional_redirect" => true,
35 35
                                 "async" => true,
36 36
                                 "css_selector" => "a[href*=\"optimizely\"]",
37 37
                                 "dependencies" => array(
38
-                                  24,
39
-                                  26
38
+                                    24,
39
+                                    26
40 40
                                 ),
41 41
                                 "destination" => "https://app.optimizely.com/",
42 42
                                 "extension_id" => 1234,
@@ -44,37 +44,37 @@  discard block
 block discarded – undo
44 44
                                 "src" => 524,
45 45
                                 "value" => "window.someGlobalFunction();",
46 46
                                 "id" => "string"
47
-                              )
47
+                                )
48 48
                             ),
49 49
                             "description" => "string",
50 50
                             "holdback" => 5000,
51 51
                             "key" => "home_page_experiment",
52 52
                             "metrics" => array(
53
-                              array(
53
+                                array(
54 54
                                 "kind" => "string",
55 55
                                 "id" => 0
56
-                              )
56
+                                )
57 57
                             ),
58 58
                             "name" => "Blue Button Experiment",
59 59
                             "schedule" => array(
60
-                              "start_time" => "2016-10-17T07:05:00.070Z",
61
-                              "stop_time" => "2016-10-17T07:05:00.070Z",
62
-                              "time_zone" => "UTC"
60
+                                "start_time" => "2016-10-17T07:05:00.070Z",
61
+                                "stop_time" => "2016-10-17T07:05:00.070Z",
62
+                                "time_zone" => "UTC"
63 63
                             ),
64 64
                             "status" => "active",
65 65
                             "variations" => array(
66
-                              array(
66
+                                array(
67 67
                                 "actions" => array(
68
-                                  array(
68
+                                    array(
69 69
                                     "changes" => array(
70
-                                      array(
70
+                                        array(
71 71
                                         "type" => "custom_code",
72 72
                                         "allow_additional_redirect" => true, 
73 73
                                         "async" => true,
74 74
                                         "css_selector" => "a[href*=\"optimizely\"]",
75 75
                                         "dependencies" => array(
76
-                                          24,
77
-                                          26
76
+                                            24,
77
+                                            26
78 78
                                         ),
79 79
                                         "destination" => "https://app.optimizely.com/",
80 80
                                         "extension_id" => 1234,
@@ -82,23 +82,23 @@  discard block
 block discarded – undo
82 82
                                         "src" => 524,
83 83
                                         "value" => "window.someGlobalFunction();",
84 84
                                         "id" => "string"
85
-                                      )
85
+                                        )
86 86
                                     ),
87 87
                                     "page_id" => 0
88
-                                  )
88
+                                    )
89 89
                                 ),
90 90
                                 "archived"=> true,
91 91
                                 "key" => "blue_button_variation",
92 92
                                 "name" => "Blue Button",
93 93
                                 "variation_id" => 0,
94 94
                                 "weight" => 0
95
-                              )
95
+                                )
96 96
                             ),
97 97
                             "created" => "2016-10-17T07:05:00.070Z",
98 98
                             "id" => 3000,
99 99
                             "is_classic" => false,
100 100
                             "last_modified" => "2016-10-17T07:05:00.070Z"
101
-                          )
101
+                            )
102 102
                         )
103 103
                     );
104 104
         
@@ -122,20 +122,20 @@  discard block
 block discarded – undo
122 122
                     ->willReturn(array(
123 123
                             "project_id" => 1000,
124 124
                             "audience_ids" => array(
125
-                              1234,
126
-                              1212,
127
-                              1432
125
+                                1234,
126
+                                1212,
127
+                                1432
128 128
                             ),
129 129
                             "campaign_id" => 2000,
130 130
                             "changes" => array(
131
-                              array(
131
+                                array(
132 132
                                 "type" => "custom_code",
133 133
                                 "allow_additional_redirect" => true,
134 134
                                 "async" => true,
135 135
                                 "css_selector" => "a[href*=\"optimizely\"]",
136 136
                                 "dependencies" => array(
137
-                                  24,
138
-                                  26
137
+                                    24,
138
+                                    26
139 139
                                 ),
140 140
                                 "destination" => "https://app.optimizely.com/",
141 141
                                 "extension_id" => 1234,
@@ -143,37 +143,37 @@  discard block
 block discarded – undo
143 143
                                 "src" => 524,
144 144
                                 "value" => "window.someGlobalFunction();",
145 145
                                 "id" => "string"
146
-                              )
146
+                                )
147 147
                             ),
148 148
                             "description" => "string",
149 149
                             "holdback" => 5000,
150 150
                             "key" => "home_page_experiment",
151 151
                             "metrics" => array(
152
-                              array(
152
+                                array(
153 153
                                 "kind" => "string",
154 154
                                 "id" => 0
155
-                              )
155
+                                )
156 156
                             ),
157 157
                             "name" => "Blue Button Experiment",
158 158
                             "schedule" => array(
159
-                              "start_time" => "2016-10-17T07:05:00.070Z",
160
-                              "stop_time" => "2016-10-17T07:05:00.070Z",
161
-                              "time_zone" => "UTC"
159
+                                "start_time" => "2016-10-17T07:05:00.070Z",
160
+                                "stop_time" => "2016-10-17T07:05:00.070Z",
161
+                                "time_zone" => "UTC"
162 162
                             ),
163 163
                             "status" => "active",
164 164
                             "variations" => array(
165
-                              array(
165
+                                array(
166 166
                                 "actions" => array(
167
-                                  array(
167
+                                    array(
168 168
                                     "changes" => array(
169
-                                      array(
169
+                                        array(
170 170
                                         "type" => "custom_code",
171 171
                                         "allow_additional_redirect" => true, 
172 172
                                         "async" => true,
173 173
                                         "css_selector" => "a[href*=\"optimizely\"]",
174 174
                                         "dependencies" => array(
175
-                                          24,
176
-                                          26
175
+                                            24,
176
+                                            26
177 177
                                         ),
178 178
                                         "destination" => "https://app.optimizely.com/",
179 179
                                         "extension_id" => 1234,
@@ -181,23 +181,23 @@  discard block
 block discarded – undo
181 181
                                         "src" => 524,
182 182
                                         "value" => "window.someGlobalFunction();",
183 183
                                         "id" => "string"
184
-                                      )
184
+                                        )
185 185
                                     ),
186 186
                                     "page_id" => 0
187
-                                  )
187
+                                    )
188 188
                                 ),
189 189
                                 "archived"=> true,
190 190
                                 "key" => "blue_button_variation",
191 191
                                 "name" => "Blue Button",
192 192
                                 "variation_id" => 0,
193 193
                                 "weight" => 0
194
-                              )
194
+                                )
195 195
                             ),
196 196
                             "created" => "2016-10-17T07:05:00.070Z",
197 197
                             "id" => 3000,
198 198
                             "is_classic" => false,
199 199
                             "last_modified" => "2016-10-17T07:05:00.070Z"
200
-                          )
200
+                            )
201 201
                         );
202 202
         
203 203
         $experimentsService = new Experiments($optimizelyApiClientMock);
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
                             "end_time" => "2016-10-17T07:05:00.089Z",
222 222
                             "experiment_id" => 3000,
223 223
                             "metrics" => array(
224
-                              array(
224
+                                array(
225 225
                                 "event" => "string",
226 226
                                 "event_name" => "string",
227 227
                                 "measure" => "conversions",
@@ -229,54 +229,54 @@  discard block
 block discarded – undo
229 229
                                 "priority" => 1,
230 230
                                 "unit" => "session",
231 231
                                 "variation_results" => array(
232
-                                  "9000" => array(
232
+                                    "9000" => array(
233 233
                                     "experiment_id" => 0,
234 234
                                     "is_baseline" => true,
235 235
                                     "lift" => array(
236
-                                      "confidence_interval" => array(
236
+                                        "confidence_interval" => array(
237 237
                                         0.010399560300730457,
238 238
                                         0.0850821459929161
239
-                                      ),
240
-                                      "is_most_conclusive" => true,
241
-                                      "is_significant" => true,
242
-                                      "significance" => 0,
243
-                                      "value" => 0,
244
-                                      "visitors_remaining" => 0
239
+                                        ),
240
+                                        "is_most_conclusive" => true,
241
+                                        "is_significant" => true,
242
+                                        "significance" => 0,
243
+                                        "value" => 0,
244
+                                        "visitors_remaining" => 0
245 245
                                     ),
246 246
                                     "name" => "Blue Button",
247 247
                                     "rate" => 0,
248 248
                                     "scope" => "variation",
249 249
                                     "total_increase" => array(
250
-                                      "confidence_interval" => array(
250
+                                        "confidence_interval" => array(
251 251
                                         0.010399560300730457,
252 252
                                         0.0850821459929161
253
-                                      ),
254
-                                      "is_most_conclusive" => true,
255
-                                      "is_significant" => true,
256
-                                      "significance" => 0,
257
-                                      "value" => 0,
258
-                                      "visitors_remaining" => 0
253
+                                        ),
254
+                                        "is_most_conclusive" => true,
255
+                                        "is_significant" => true,
256
+                                        "significance" => 0,
257
+                                        "value" => 0,
258
+                                        "visitors_remaining" => 0
259 259
                                     ),
260 260
                                     "value" => 0,
261 261
                                     "variation_id" => "string"
262
-                                  )
262
+                                    )
263
+                                )
263 264
                                 )
264
-                              )
265 265
                             ),
266 266
                             "reach" => array(
267
-                              "baseline_count" => 0,
268
-                              "baseline_reach" => 0,
269
-                              "total_count" => 0,
270
-                              "treatment_count" => 0,
271
-                              "treatment_reach" => 0,
272
-                              "variations" => array(
267
+                                "baseline_count" => 0,
268
+                                "baseline_reach" => 0,
269
+                                "total_count" => 0,
270
+                                "treatment_count" => 0,
271
+                                "treatment_reach" => 0,
272
+                                "variations" => array(
273 273
                                 "9000" => array(
274
-                                  "count" => 0,
275
-                                  "name" => "Blue Button",
276
-                                  "variation_id" => "string",
277
-                                  "variation_reach" => 0
274
+                                    "count" => 0,
275
+                                    "name" => "Blue Button",
276
+                                    "variation_id" => "string",
277
+                                    "variation_reach" => 0
278
+                                )
278 279
                                 )
279
-                              )
280 280
                             ),
281 281
                             "start_time" => "2016-10-17T07:05:00.090Z"
282 282
                         ));
@@ -300,20 +300,20 @@  discard block
 block discarded – undo
300 300
                     ->willReturn(array(
301 301
                             "project_id" => 1000,
302 302
                             "audience_ids" => array(
303
-                              1234,
304
-                              1212,
305
-                              1432
303
+                                1234,
304
+                                1212,
305
+                                1432
306 306
                             ),
307 307
                             "campaign_id" => 2000,
308 308
                             "changes" => array(
309
-                              array(
309
+                                array(
310 310
                                 "type" => "custom_code",
311 311
                                 "allow_additional_redirect" => true,
312 312
                                 "async" => true,
313 313
                                 "css_selector" => "a[href*=\"optimizely\"]",
314 314
                                 "dependencies" => array(
315
-                                  24,
316
-                                  26
315
+                                    24,
316
+                                    26
317 317
                                 ),
318 318
                                 "destination" => "https://app.optimizely.com/",
319 319
                                 "extension_id" => 1234,
@@ -321,37 +321,37 @@  discard block
 block discarded – undo
321 321
                                 "src" => 524,
322 322
                                 "value" => "window.someGlobalFunction();",
323 323
                                 "id" => "string"
324
-                              )
324
+                                )
325 325
                             ),
326 326
                             "description" => "string",
327 327
                             "holdback" => 5000,
328 328
                             "key" => "home_page_experiment",
329 329
                             "metrics" => array(
330
-                              array(
330
+                                array(
331 331
                                 "kind" => "string",
332 332
                                 "id" => 0
333
-                              )
333
+                                )
334 334
                             ),
335 335
                             "name" => "Blue Button Experiment",
336 336
                             "schedule" => array(
337
-                              "start_time" => "2016-10-17T07:05:00.099Z",
338
-                              "stop_time" => "2016-10-17T07:05:00.099Z",
339
-                              "time_zone" => "UTC"
337
+                                "start_time" => "2016-10-17T07:05:00.099Z",
338
+                                "stop_time" => "2016-10-17T07:05:00.099Z",
339
+                                "time_zone" => "UTC"
340 340
                             ),
341 341
                             "status" => "active",
342 342
                             "variations" => array(
343
-                              array(
343
+                                array(
344 344
                                 "actions" => array(
345
-                                  array(
345
+                                    array(
346 346
                                     "changes" => array(
347
-                                      array(
347
+                                        array(
348 348
                                         "type" => "custom_code",
349 349
                                         "allow_additional_redirect" => true,
350 350
                                         "async" => true,
351 351
                                         "css_selector" => "a[href*=\"optimizely\"]",
352 352
                                         "dependencies" => array(
353
-                                          24,
354
-                                          26
353
+                                            24,
354
+                                            26
355 355
                                         ),
356 356
                                         "destination" => "https://app.optimizely.com/",
357 357
                                         "extension_id" => 1234,
@@ -359,17 +359,17 @@  discard block
 block discarded – undo
359 359
                                         "src" => 524,
360 360
                                         "value" => "window.someGlobalFunction();",
361 361
                                         "id" => "string"
362
-                                      )
362
+                                        )
363 363
                                     ),
364 364
                                     "page_id" => 0
365
-                                  )
365
+                                    )
366 366
                                 ),
367 367
                                 "archived" => true,
368 368
                                 "key" => "blue_button_variation",
369 369
                                 "name" => "Blue Button",
370 370
                                 "variation_id" => 0,
371 371
                                 "weight" => 0
372
-                              )
372
+                                )
373 373
                             ),
374 374
                             "created" => "2016-10-17T07:05:00.099Z",
375 375
                             "id" => 3000,
@@ -382,73 +382,73 @@  discard block
 block discarded – undo
382 382
         $experiment = new Experiment(array(
383 383
             "project_id" => 1000,
384 384
             "audience_ids" => array(
385
-              1234,
386
-              1212,
387
-              1432
385
+                1234,
386
+                1212,
387
+                1432
388 388
             ),
389 389
             "campaign_id" => 2000,
390 390
             "changes" => array(
391
-              array(
391
+                array(
392 392
                 "type" => "custom_code",
393 393
                 "allow_additional_redirect" => true,
394 394
                 "async" => true,
395 395
                 "css_selector" => "a[href*=\"optimizely\"]",
396 396
                 "dependencies" => array(
397
-                  24,
398
-                  26
397
+                    24,
398
+                    26
399 399
                 ),
400 400
                 "destination" => "https://app.optimizely.com/",
401 401
                 "extension_id" => 1234,
402 402
                 "preserve_parameters" => true,
403 403
                 "src" => 524,
404 404
                 "value" => "window.someGlobalFunction();"
405
-              )
405
+                )
406 406
             ),
407 407
             "description" => "string",
408 408
             "holdback" => 5000,
409 409
             "key" => "home_page_experiment",
410 410
             "metrics" => array(
411
-              array(
411
+                array(
412 412
                 "kind" => "string"
413
-              )
413
+                )
414 414
             ),
415 415
             "name" => "Blue Button Experiment",
416 416
             "schedule" => array(
417
-              "start_time" => "2016-10-17T07:04:59.724Z",
418
-              "stop_time" => "2016-10-17T07:04:59.724Z",
419
-              "time_zone" => "UTC"
417
+                "start_time" => "2016-10-17T07:04:59.724Z",
418
+                "stop_time" => "2016-10-17T07:04:59.724Z",
419
+                "time_zone" => "UTC"
420 420
             ),
421 421
             "status" => "active",
422 422
             "variations" => array(
423
-              array(
423
+                array(
424 424
                 "actions" => array(
425
-                  array(
425
+                    array(
426 426
                     "changes" => array(
427
-                      array(
427
+                        array(
428 428
                         "type" => "custom_code",
429 429
                         "allow_additional_redirect" => true,
430 430
                         "async" => true,
431 431
                         "css_selector" => "a[href*=\"optimizely\"]",
432 432
                         "dependencies" => array(
433
-                          24,
434
-                          26
433
+                            24,
434
+                            26
435 435
                         ),
436 436
                         "destination" => "https://app.optimizely.com/",
437 437
                         "extension_id" => 1234,
438 438
                         "preserve_parameters" => true,
439 439
                         "src" => 524,
440 440
                         "value" => "window.someGlobalFunction();"
441
-                      )
441
+                        )
442 442
                     ),
443 443
                     "page_id" => 0
444
-                  )
444
+                    )
445 445
                 ),
446 446
                 "archived" => true,
447 447
                 "key" => "blue_button_variation",
448 448
                 "name" => "Blue Button",
449 449
                 "variation_id" => 0,
450 450
                 "weight" => 0
451
-              )
451
+                )
452 452
             )
453 453
         ));
454 454
         
@@ -469,20 +469,20 @@  discard block
 block discarded – undo
469 469
                     ->willReturn(array(
470 470
                         "project_id" => 1000,
471 471
                         "audience_ids" => array(
472
-                          1234,
473
-                          1212,
474
-                          1432
472
+                            1234,
473
+                            1212,
474
+                            1432
475 475
                         ),
476 476
                         "campaign_id" => 2000,
477 477
                         "changes" => array(
478
-                          array(
478
+                            array(
479 479
                             "type" => "custom_code",
480 480
                             "allow_additional_redirect" => true,
481 481
                             "async" => true,
482 482
                             "css_selector" => "a[href*=\"optimizely\"]",
483 483
                             "dependencies" => array(
484
-                              24,
485
-                              26
484
+                                24,
485
+                                26
486 486
                             ),
487 487
                             "destination" => "https://app.optimizely.com/",
488 488
                             "extension_id" => 1234,
@@ -490,37 +490,37 @@  discard block
 block discarded – undo
490 490
                             "src" => 524,
491 491
                             "value" => "window.someGlobalFunction();",
492 492
                             "id" => "string"
493
-                          )
493
+                            )
494 494
                         ),
495 495
                         "description" => "string",
496 496
                         "holdback" => 5000,
497 497
                         "key" => "home_page_experiment",
498 498
                         "metrics" => array(
499
-                          array(
499
+                            array(
500 500
                             "kind" => "string",
501 501
                             "id" => 0
502
-                          )
502
+                            )
503 503
                         ),
504 504
                         "name" => "Blue Button Experiment",
505 505
                         "schedule" => array(
506
-                          "start_time" => "2016-10-17T07:05:00.109Z",
507
-                          "stop_time" => "2016-10-17T07:05:00.109Z",
508
-                          "time_zone" => "UTC"
506
+                            "start_time" => "2016-10-17T07:05:00.109Z",
507
+                            "stop_time" => "2016-10-17T07:05:00.109Z",
508
+                            "time_zone" => "UTC"
509 509
                         ),
510 510
                         "status" => "active",
511 511
                         "variations" => array(
512
-                          array(
512
+                            array(
513 513
                             "actions" => array(
514
-                              array(
514
+                                array(
515 515
                                 "changes" => array(
516
-                                  array(
516
+                                    array(
517 517
                                     "type" => "custom_code",
518 518
                                     "allow_additional_redirect" => true,
519 519
                                     "async" => true,
520 520
                                     "css_selector" => "a[href*=\"optimizely\"]",
521 521
                                     "dependencies" => array(
522
-                                      24,
523
-                                      26
522
+                                        24,
523
+                                        26
524 524
                                     ),
525 525
                                     "destination" => "https://app.optimizely.com/",
526 526
                                     "extension_id" => 1234,
@@ -528,17 +528,17 @@  discard block
 block discarded – undo
528 528
                                     "src" => 524,
529 529
                                     "value" => "window.someGlobalFunction();",
530 530
                                     "id" => "string"
531
-                                  )
531
+                                    )
532 532
                                 ),
533 533
                                 "page_id" => 0
534
-                              )
534
+                                )
535 535
                             ),
536 536
                             "archived" => true,
537 537
                             "key" => "blue_button_variation",
538 538
                             "name" => "Blue Button",
539 539
                             "variation_id" => 0,
540 540
                             "weight" => 0
541
-                          )
541
+                            )
542 542
                         ),
543 543
                         "created" => "2016-10-17T07:05:00.109Z",
544 544
                         "id" => 3000,
@@ -549,72 +549,72 @@  discard block
 block discarded – undo
549 549
         $experimentsService = new Experiments($optimizelyApiClientMock);
550 550
         
551 551
         $experiment = new Experiment(array(
552
-              "audience_ids" => array(
552
+                "audience_ids" => array(
553 553
                 0
554
-              ),
555
-              "changes" => array(
554
+                ),
555
+                "changes" => array(
556 556
                 array(
557
-                  "type" => "custom_code",
558
-                  "allow_additional_redirect" => true,
559
-                  "async" => true,
560
-                  "css_selector" => "a[href*=\"optimizely\"]",
561
-                  "dependencies" => array(
557
+                    "type" => "custom_code",
558
+                    "allow_additional_redirect" => true,
559
+                    "async" => true,
560
+                    "css_selector" => "a[href*=\"optimizely\"]",
561
+                    "dependencies" => array(
562 562
                     24,
563 563
                     26
564
-                  ),
565
-                  "destination" => "https://app.optimizely.com/",
566
-                  "extension_id" => 1234,
567
-                  "preserve_parameters" => true,
568
-                  "src" => 524,
569
-                  "value" => "window.someGlobalFunction();"
564
+                    ),
565
+                    "destination" => "https://app.optimizely.com/",
566
+                    "extension_id" => 1234,
567
+                    "preserve_parameters" => true,
568
+                    "src" => 524,
569
+                    "value" => "window.someGlobalFunction();"
570 570
                 )
571
-              ),
572
-              "description" => "AB Test to see if the Blue Button converts more visitors",
573
-              "holdback" => 0,
574
-              "key" => "home_page_experiment",
575
-              "metrics" => array(
571
+                ),
572
+                "description" => "AB Test to see if the Blue Button converts more visitors",
573
+                "holdback" => 0,
574
+                "key" => "home_page_experiment",
575
+                "metrics" => array(
576 576
                 array(
577
-                  "kind" => "string"
577
+                    "kind" => "string"
578 578
                 )
579
-              ),
580
-              "name" => "Blue Button Experiment",
581
-              "schedule" => array(
579
+                ),
580
+                "name" => "Blue Button Experiment",
581
+                "schedule" => array(
582 582
                 "start_time" => "2016-10-17T07:04:59.731Z",
583 583
                 "stop_time" => "2016-10-17T07:04:59.731Z",
584 584
                 "time_zone" => "UTC"
585
-              ),
586
-              "status" => "active",
587
-              "variations" => array(
585
+                ),
586
+                "status" => "active",
587
+                "variations" => array(
588 588
                 array(
589
-                  "actions" => array(
589
+                    "actions" => array(
590 590
                     array(
591
-                      "changes" => array(
591
+                        "changes" => array(
592 592
                         array(
593
-                          "type" => "custom_code",
594
-                          "allow_additional_redirect" => true,
595
-                          "async" => true,
596
-                          "css_selector" => "a[href*=\"optimizely\"]",
597
-                          "dependencies" => array(
593
+                            "type" => "custom_code",
594
+                            "allow_additional_redirect" => true,
595
+                            "async" => true,
596
+                            "css_selector" => "a[href*=\"optimizely\"]",
597
+                            "dependencies" => array(
598 598
                             24,
599 599
                             26
600
-                          ),
601
-                          "destination" => "https://app.optimizely.com/",
602
-                          "extension_id" => 1234,
603
-                          "preserve_parameters" => true,
604
-                          "src" => 524,
605
-                          "value" => "window.someGlobalFunction();"
600
+                            ),
601
+                            "destination" => "https://app.optimizely.com/",
602
+                            "extension_id" => 1234,
603
+                            "preserve_parameters" => true,
604
+                            "src" => 524,
605
+                            "value" => "window.someGlobalFunction();"
606 606
                         )
607
-                      ),
608
-                      "page_id" => 0
607
+                        ),
608
+                        "page_id" => 0
609 609
                     )
610
-                  ),
611
-                  "archived" => true,
612
-                  "key" => "blue_button_variation",
613
-                  "name" => "Blue Button",
614
-                  "variation_id" => 0,
615
-                  "weight" => 0
610
+                    ),
611
+                    "archived" => true,
612
+                    "key" => "blue_button_variation",
613
+                    "name" => "Blue Button",
614
+                    "variation_id" => 0,
615
+                    "weight" => 0
616
+                )
616 617
                 )
617
-              )
618 618
         ));
619 619
         
620 620
         $updatedExperiment = $experimentsService->update(1000, $experiment, true, true);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
         
107 107
         $experiments = $experimentsService->listAll(1000);
108 108
         
109
-        $this->assertTrue(count($experiments)==1);
109
+        $this->assertTrue(count($experiments) == 1);
110 110
         $this->assertTrue($experiments[0] instanceOf Experiment);
111
-        $this->assertTrue($experiments[0]->getName()=='Blue Button Experiment');        
111
+        $this->assertTrue($experiments[0]->getName() == 'Blue Button Experiment');        
112 112
     }
113 113
     
114 114
     public function testGet()
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         $experiment = $experimentsService->get(3000);
206 206
         
207 207
         $this->assertTrue($experiment instanceOf Experiment);
208
-        $this->assertTrue($experiment->getName()=='Blue Button Experiment');        
208
+        $this->assertTrue($experiment->getName() == 'Blue Button Experiment');        
209 209
     }
210 210
     
211 211
     public function testGetResults()
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         $experimentResults = $experimentsService->getResults(3000);
287 287
         
288 288
         $this->assertTrue($experimentResults instanceOf ExperimentResults);
289
-        $this->assertTrue($experimentResults->getConfidenceThreshold()==0.9);        
289
+        $this->assertTrue($experimentResults->getConfidenceThreshold() == 0.9);        
290 290
     }
291 291
     
292 292
     public function testCreate()
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
         $createdExperiment = $experimentsService->create($experiment, true);
456 456
         
457 457
         $this->assertTrue($createdExperiment instanceOf Experiment);
458
-        $this->assertTrue($createdExperiment->getName()=='Blue Button Experiment');                
458
+        $this->assertTrue($createdExperiment->getName() == 'Blue Button Experiment');                
459 459
     }
460 460
     
461 461
     public function testUpdate()
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
         $updatedExperiment = $experimentsService->update(1000, $experiment, true, true);
621 621
         
622 622
         $this->assertTrue($updatedExperiment instanceOf Experiment);
623
-        $this->assertTrue($updatedExperiment->getName()=='Blue Button Experiment');                
623
+        $this->assertTrue($updatedExperiment->getName() == 'Blue Button Experiment');                
624 624
     }
625 625
     
626 626
     public function testDelete()
Please login to merge, or discard this patch.
tests/OptimizelyPHPTest/Service/v2/BaseServiceTest.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
         $credentials = file_get_contents(dirname(__FILE__) . '/../../../auth_credentials.json');
12 12
         if ($credentials===false) {
13 13
             $this->fail("Couldn't read OAuth credentials from auth_credentials.json. Make sure " .
14
-                 "the file exists (if not, copy from auth_credentials.json.dist).");
14
+                    "the file exists (if not, copy from auth_credentials.json.dist).");
15 15
         }
16 16
 
17 17
         $credentials = json_decode($credentials, true);
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@  discard block
 block discarded – undo
8 8
     public function loadCredentialsFromFile()
9 9
     {
10 10
         // Get OAuth 2.0 credentials from auth_credentials.json file.
11
-        $credentials = file_get_contents(dirname(__FILE__) . '/../../../auth_credentials.json');
12
-        if ($credentials===false) {
13
-            $this->fail("Couldn't read OAuth credentials from auth_credentials.json. Make sure " .
11
+        $credentials = file_get_contents(dirname(__FILE__).'/../../../auth_credentials.json');
12
+        if ($credentials === false) {
13
+            $this->fail("Couldn't read OAuth credentials from auth_credentials.json. Make sure ".
14 14
                  "the file exists (if not, copy from auth_credentials.json.dist).");
15 15
         }
16 16
 
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
         }
21 21
 
22 22
         // Try to read access_token.json and merge it with the rest of credentials.
23
-        if (is_readable(dirname(__FILE__) . '/../../../access_token.json')) {
24
-            $accessToken = file_get_contents(dirname(__FILE__) . '/access_token.json');
23
+        if (is_readable(dirname(__FILE__).'/../../../access_token.json')) {
24
+            $accessToken = file_get_contents(dirname(__FILE__).'/access_token.json');
25 25
 
26 26
             $accessToken = json_decode($accessToken, true);
27 27
             if (!is_array($accessToken)) {
Please login to merge, or discard this patch.
tests/OptimizelyPHPTest/Service/v2/CampaignsTest.php 2 patches
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
                         )
64 64
                     );
65 65
         
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
                     ->willReturn(array(
84 84
                             "project_id" => 1000,
85 85
                             "changes" => array(
86
-                              array(
86
+                                array(
87 87
                                 "type" => "custom_code",
88 88
                                 "allow_additional_redirect" => true,
89 89
                                 "async" => true,
90 90
                                 "css_selector" => "a[href*=\"optimizely\"]",
91 91
                                 "dependencies" => array(
92
-                                  24,
93
-                                  26
92
+                                    24,
93
+                                    26
94 94
                                 ),
95 95
                                 "destination" => "https://app.optimizely.com/",
96 96
                                 "extension_id" => 1234,
@@ -98,25 +98,25 @@  discard block
 block discarded – undo
98 98
                                 "src" => 524,
99 99
                                 "value" => "window.someGlobalFunction();",
100 100
                                 "id" => "string"
101
-                              )
101
+                                )
102 102
                             ),
103 103
                             "created" => "2016-10-18T03:27:04.139Z",
104 104
                             "earliest" => "2016-10-18T03:27:04.139Z",
105 105
                             "experiment_ids" => array(
106
-                              0
106
+                                0
107 107
                             ),
108 108
                             "holdback" => 0,
109 109
                             "last_modified" => "2016-10-18T03:27:04.139Z",
110 110
                             "latest" => "2016-10-18T03:27:04.139Z",
111 111
                             "metrics" => array(
112
-                              array(
112
+                                array(
113 113
                                 "kind" => "string",
114 114
                                 "id" => 0
115
-                              )
115
+                                )
116 116
                             ),
117 117
                             "name" => "Landing Page Optimization",
118 118
                             "page_ids" => array(
119
-                              0
119
+                                0
120 120
                             ),
121 121
                             "status" => "active",
122 122
                             "type" => "a/b",
@@ -144,47 +144,47 @@  discard block
 block discarded – undo
144 144
                             "confidence_threshold" => 0,
145 145
                             "end_time" => "2016-10-18T03:27:04.147Z",
146 146
                             "metrics" => array(
147
-                              array(
147
+                                array(
148 148
                                 "event" => "string",
149 149
                                 "event_name" => "string",
150 150
                                 "measure" => "conversions",
151 151
                                 "metric_id" => "string",
152 152
                                 "priority" => 0,
153 153
                                 "results" => array(
154
-                                  "campaign" => array(
154
+                                    "campaign" => array(
155 155
                                     "experiment_id" => 0,
156 156
                                     "is_baseline" => true,
157 157
                                     "lift" => array(
158
-                                      "confidence_interval" => array(
158
+                                        "confidence_interval" => array(
159 159
                                         0.010399560300730457,
160 160
                                         0.0850821459929161
161
-                                      ),
162
-                                      "is_most_conclusive" => true,
163
-                                      "is_significant" => true,
164
-                                      "significance" => 0,
165
-                                      "value" => 0,
166
-                                      "visitors_remaining" => 0
161
+                                        ),
162
+                                        "is_most_conclusive" => true,
163
+                                        "is_significant" => true,
164
+                                        "significance" => 0,
165
+                                        "value" => 0,
166
+                                        "visitors_remaining" => 0
167 167
                                     ),
168 168
                                     "name" => "Blue Button",
169 169
                                     "rate" => 0,
170 170
                                     "scope" => "variation",
171 171
                                     "total_increase" => array(
172
-                                      "confidence_interval" => array(
172
+                                        "confidence_interval" => array(
173 173
                                         0.010399560300730457,
174 174
                                         0.0850821459929161
175
-                                      ),
176
-                                      "is_most_conclusive" => true,
177
-                                      "is_significant" => true,
178
-                                      "significance" => 0,
179
-                                      "value" => 0,
180
-                                      "visitors_remaining" => 0
175
+                                        ),
176
+                                        "is_most_conclusive" => true,
177
+                                        "is_significant" => true,
178
+                                        "significance" => 0,
179
+                                        "value" => 0,
180
+                                        "visitors_remaining" => 0
181 181
                                     ),
182 182
                                     "value" => 0,
183 183
                                     "variation_id" => "string"
184
-                                  )
184
+                                    )
185 185
                                 ),
186 186
                                 "unit" => "session"
187
-                              )
187
+                                )
188 188
                             ),
189 189
                             "start_time" => "2016-10-18T03:27:04.148Z"
190 190
                         ));
@@ -209,14 +209,14 @@  discard block
 block discarded – undo
209 209
                     ->willReturn(array(
210 210
                             "project_id" => 1000,
211 211
                             "changes" => array(
212
-                              array(
212
+                                array(
213 213
                                 "type" => "custom_code",
214 214
                                 "allow_additional_redirect" => true, 
215 215
                                 "async" => true,
216 216
                                 "css_selector" => "a[href*=\"optimizely\"]",
217 217
                                 "dependencies" => array(
218
-                                  24,
219
-                                  26
218
+                                    24,
219
+                                    26
220 220
                                 ),
221 221
                                 "destination" => "https://app.optimizely.com/",
222 222
                                 "extension_id" => 1234,
@@ -224,25 +224,25 @@  discard block
 block discarded – undo
224 224
                                 "src" => 524,
225 225
                                 "value" => "window.someGlobalFunction();",
226 226
                                 "id" => "string"
227
-                              )
227
+                                )
228 228
                             ),
229 229
                             "created" => "2016-10-18T03:27:04.155Z",
230 230
                             "earliest" => "2016-10-18T03:27:04.155Z",
231 231
                             "experiment_ids" => array(
232
-                              0
232
+                                0
233 233
                             ),
234 234
                             "holdback" => 0,
235 235
                             "last_modified" => "2016-10-18T03:27:04.155Z",
236 236
                             "latest" => "2016-10-18T03:27:04.155Z",
237 237
                             "metrics" => array(
238
-                              array(
238
+                                array(
239 239
                                 "kind" => "string",
240 240
                                 "id" => 0
241
-                              )
241
+                                )
242 242
                             ),
243 243
                             "name" => "Landing Page Optimization",
244 244
                             "page_ids" => array(
245
-                              0
245
+                                0
246 246
                             ),
247 247
                             "status" => "active",
248 248
                             "type" => "a/b",
@@ -254,38 +254,38 @@  discard block
 block discarded – undo
254 254
         $campaign = new Campaign(array(
255 255
                 "project_id" => 1000,
256 256
                 "changes" => array(
257
-                  array(
257
+                    array(
258 258
                     "type" => "custom_code",
259 259
                     "allow_additional_redirect" => true,
260 260
                     "async" => true,
261 261
                     "css_selector" => "a[href*=\"optimizely\"]",
262 262
                     "dependencies" => array(
263
-                      24,
264
-                      26
263
+                        24,
264
+                        26
265 265
                     ),
266 266
                     "destination" => "https://app.optimizely.com/",
267 267
                     "extension_id" => 1234,
268 268
                     "preserve_parameters" => true,
269 269
                     "src" => 524,
270 270
                     "value" => "window.someGlobalFunction();"
271
-                  )
271
+                    )
272 272
                 ),
273 273
                 "created" => "2016-10-18T03:27:04.067Z",
274 274
                 "earliest" => "2016-10-18T03:27:04.067Z",
275 275
                 "experiment_ids" => array(
276
-                  0
276
+                    0
277 277
                 ),
278 278
                 "holdback" => 0,
279 279
                 "last_modified" => "2016-10-18T03:27:04.067Z",
280 280
                 "latest" => "2016-10-18T03:27:04.067Z",
281 281
                 "metrics" => array(
282
-                  array(
282
+                    array(
283 283
                     "kind" => "string"
284
-                  )
284
+                    )
285 285
                 ),
286 286
                 "name" => "Landing Page Optimization",
287 287
                 "page_ids" => array(
288
-                  0
288
+                    0
289 289
                 ),
290 290
                 "status" => "active",
291 291
                 "type" => "a/b"
@@ -308,14 +308,14 @@  discard block
 block discarded – undo
308 308
                     ->willReturn(array(
309 309
                             "project_id" => 1000,
310 310
                             "changes" => array(
311
-                              array(
311
+                                array(
312 312
                                 "type" => "custom_code",
313 313
                                 "allow_additional_redirect" => true, 
314 314
                                 "async" => true,
315 315
                                 "css_selector" => "a[href*=\"optimizely\"]",
316 316
                                 "dependencies" => array(
317
-                                  24,
318
-                                  26
317
+                                    24,
318
+                                    26
319 319
                                 ),
320 320
                                 "destination" => "https://app.optimizely.com/",
321 321
                                 "extension_id" => 1234,
@@ -323,25 +323,25 @@  discard block
 block discarded – undo
323 323
                                 "src" => 524,
324 324
                                 "value" => "window.someGlobalFunction();",
325 325
                                 "id" => "string"
326
-                              )
326
+                                )
327 327
                             ),
328 328
                             "created" => "2016-10-18T03:27:04.155Z",
329 329
                             "earliest" => "2016-10-18T03:27:04.155Z",
330 330
                             "experiment_ids" => array(
331
-                              0
331
+                                0
332 332
                             ),
333 333
                             "holdback" => 0,
334 334
                             "last_modified" => "2016-10-18T03:27:04.155Z",
335 335
                             "latest" => "2016-10-18T03:27:04.155Z",
336 336
                             "metrics" => array(
337
-                              array(
337
+                                array(
338 338
                                 "kind" => "string",
339 339
                                 "id" => 0
340
-                              )
340
+                                )
341 341
                             ),
342 342
                             "name" => "Landing Page Optimization",
343 343
                             "page_ids" => array(
344
-                              0
344
+                                0
345 345
                             ),
346 346
                             "status" => "active",
347 347
                             "type" => "a/b",
@@ -353,38 +353,38 @@  discard block
 block discarded – undo
353 353
         $campaign = new Campaign(array(
354 354
                 "project_id" => 1000,
355 355
                 "changes" => array(
356
-                  array(
356
+                    array(
357 357
                     "type" => "custom_code",
358 358
                     "allow_additional_redirect" => true,
359 359
                     "async" => true,
360 360
                     "css_selector" => "a[href*=\"optimizely\"]",
361 361
                     "dependencies" => array(
362
-                      24,
363
-                      26
362
+                        24,
363
+                        26
364 364
                     ),
365 365
                     "destination" => "https://app.optimizely.com/",
366 366
                     "extension_id" => 1234,
367 367
                     "preserve_parameters" => true,
368 368
                     "src" => 524,
369 369
                     "value" => "window.someGlobalFunction();"
370
-                  )
370
+                    )
371 371
                 ),
372 372
                 "created" => "2016-10-18T03:27:04.067Z",
373 373
                 "earliest" => "2016-10-18T03:27:04.067Z",
374 374
                 "experiment_ids" => array(
375
-                  0
375
+                    0
376 376
                 ),
377 377
                 "holdback" => 0,
378 378
                 "last_modified" => "2016-10-18T03:27:04.067Z",
379 379
                 "latest" => "2016-10-18T03:27:04.067Z",
380 380
                 "metrics" => array(
381
-                  array(
381
+                    array(
382 382
                     "kind" => "string"
383
-                  )
383
+                    )
384 384
                 ),
385 385
                 "name" => "Landing Page Optimization",
386 386
                 "page_ids" => array(
387
-                  0
387
+                    0
388 388
                 ),
389 389
                 "status" => "active",
390 390
                 "type" => "a/b"
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
         
68 68
         $campaigns = $campaignsService->listAll(1000);
69 69
         
70
-        $this->assertTrue(count($campaigns)==1);
70
+        $this->assertTrue(count($campaigns) == 1);
71 71
         $this->assertTrue($campaigns[0] instanceOf Campaign);
72
-        $this->assertTrue($campaigns[0]->getName()=='Landing Page Optimization');        
72
+        $this->assertTrue($campaigns[0]->getName() == 'Landing Page Optimization');        
73 73
     }
74 74
     
75 75
     public function testGet()
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         $campaign = $campaignsService->get(2000);
129 129
         
130 130
         $this->assertTrue($campaign instanceOf Campaign);
131
-        $this->assertTrue($campaign->getName()=='Landing Page Optimization');        
131
+        $this->assertTrue($campaign->getName() == 'Landing Page Optimization');        
132 132
     }
133 133
     
134 134
     public function testGetResults()
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
         $campaignResults = $campaignsService->getResults(3000);
195 195
         
196 196
         $this->assertTrue($campaignResults instanceOf CampaignResults);
197
-        $this->assertTrue($campaignResults->getConfidenceThreshold()==0);        
198
-        $this->assertTrue($campaignResults->getStartTime()=="2016-10-18T03:27:04.148Z");        
197
+        $this->assertTrue($campaignResults->getConfidenceThreshold() == 0);        
198
+        $this->assertTrue($campaignResults->getStartTime() == "2016-10-18T03:27:04.148Z");        
199 199
     }
200 200
     
201 201
     public function testCreate()
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
         $createdCampaign = $campaignsService->create($campaign);
295 295
         
296 296
         $this->assertTrue($createdCampaign instanceOf Campaign);
297
-        $this->assertTrue($createdCampaign->getName()=='Landing Page Optimization');                
297
+        $this->assertTrue($createdCampaign->getName() == 'Landing Page Optimization');                
298 298
     }
299 299
     
300 300
     public function testUpdate()
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
         $updatedCampaign = $campaignsService->update(2000, $campaign);
394 394
         
395 395
         $this->assertTrue($updatedCampaign instanceOf Campaign);
396
-        $this->assertTrue($updatedCampaign->getName()=='Landing Page Optimization');                
396
+        $this->assertTrue($updatedCampaign->getName() == 'Landing Page Optimization');                
397 397
     }
398 398
     
399 399
     public function testDelete()
Please login to merge, or discard this patch.