Completed
Push — master ( e5901e...66735f )
by James
02:26
created
examples/Experiments/CreateExperiment.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,6 @@
 block discarded – undo
13 13
  */
14 14
 
15 15
 use WebMarketingROI\OptimizelyPHP\OptimizelyApiClient;
16
-use WebMarketingROI\OptimizelyPHP\Resource\v2\Project;
17 16
 
18 17
 // Init class autloading.
19 18
 include dirname(__FILE__) . '/../../vendor/autoload.php';
Please login to merge, or discard this patch.
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -32,73 +32,73 @@
 block discarded – undo
32 32
     $project = new Experiment(array(
33 33
             "project_id" => 1000,
34 34
             "audience_ids" => array(
35
-              1234,
36
-              1212,
37
-              1432
35
+                1234,
36
+                1212,
37
+                1432
38 38
             ),
39 39
             "campaign_id" => 2000,
40 40
             "changes" => array(
41
-              array(
41
+                array(
42 42
                 "type" => "custom_code",
43 43
                 "allow_additional_redirect" => true,
44 44
                 "async" => true,
45 45
                 "css_selector" => "a[href*=\"optimizely\"]",
46 46
                 "dependencies" => array(
47
-                  24,
48
-                  26
47
+                    24,
48
+                    26
49 49
                 ),
50 50
                 "destination" => "https://app.optimizely.com/",
51 51
                 "extension_id" => 1234,
52 52
                 "preserve_parameters" => true,
53 53
                 "src" => 524,
54 54
                 "value" => "window.someGlobalFunction();"
55
-              )
55
+                )
56 56
             ),
57 57
             "description" => "string",
58 58
             "holdback" => 5000,
59 59
             "key" => "home_page_experiment",
60 60
             "metrics" => array(
61
-              array(
61
+                array(
62 62
                 "kind" => "string"
63
-              )
63
+                )
64 64
             ),
65 65
             "name" => "Blue Button Experiment",
66 66
             "schedule" => array(
67
-              "start_time" => "2016-10-17T07:04:59.724Z",
68
-              "stop_time" => "2016-10-17T07:04:59.724Z",
69
-              "time_zone" => "UTC"
67
+                "start_time" => "2016-10-17T07:04:59.724Z",
68
+                "stop_time" => "2016-10-17T07:04:59.724Z",
69
+                "time_zone" => "UTC"
70 70
             ),
71 71
             "status" => "active",
72 72
             "variations" => array(
73
-              array(
73
+                array(
74 74
                 "actions" => array(
75
-                  array(
75
+                    array(
76 76
                     "changes" => array(
77
-                      array(
77
+                        array(
78 78
                         "type" => "custom_code",
79 79
                         "allow_additional_redirect" => true,
80 80
                         "async" => true,
81 81
                         "css_selector" => "a[href*=\"optimizely\"]",
82 82
                         "dependencies" => array(
83
-                          24,
84
-                          26
83
+                            24,
84
+                            26
85 85
                         ),
86 86
                         "destination" => "https://app.optimizely.com/",
87 87
                         "extension_id" => 1234,
88 88
                         "preserve_parameters" => true,
89 89
                         "src" => 524,
90 90
                         "value" => "window.someGlobalFunction();"
91
-                      )
91
+                        )
92 92
                     ),
93 93
                     "page_id" => 0
94
-                  )
94
+                    )
95 95
                 ),
96 96
                 "archived" => true,
97 97
                 "key" => "blue_button_variation",
98 98
                 "name" => "Blue Button",
99 99
                 "variation_id" => 0,
100 100
                 "weight" => 0
101
-              )
101
+                )
102 102
             )
103 103
         ));
104 104
         
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 use WebMarketingROI\OptimizelyPHP\Resource\v2\Project;
18 18
 
19 19
 // Init class autloading.
20
-include dirname(__FILE__) . '/../../vendor/autoload.php';
20
+include dirname(__FILE__).'/../../vendor/autoload.php';
21 21
 
22 22
 // Include Utils.php - a file containing helper functions
23
-include dirname(__FILE__) . '/../Utils.php';
23
+include dirname(__FILE__).'/../Utils.php';
24 24
 
25 25
 // Get OAuth 2.0 credentials from auth_credentials.json and access_token.json files.
26 26
 $credentials = load_credentials_from_file();
@@ -117,6 +117,6 @@  discard block
 block discarded – undo
117 117
 
118 118
 // Save access token for later use
119 119
 $accessToken = $optimizelyClient->getAccessToken();
120
-file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken));
120
+file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken));
121 121
 
122 122
 echo "Done!\n";
123 123
\ No newline at end of file
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Service/v2/Campaigns.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
     /**
93 93
      * Get campaign results
94 94
      * @param integer $campaignId The id for the campaign you want results for
95
-     * @param string $starTime The earliest time to count events in results. Defaults to the time that the campaign was first activated.
95
+     * @param string $startTime The earliest time to count events in results. Defaults to the time that the campaign was first activated.
96 96
      * @param string $endTime The latest time to count events in results. Defaults to the time the campaign was last active or the current time if the campaign is still running.
97 97
      * @throws \Exception
98 98
      */
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,21 +36,21 @@  discard block
 block discarded – undo
36 36
      * @return Result
37 37
      * @throws Exception
38 38
      */
39
-    public function listAll($projectId, $page=1, $perPage=25)
39
+    public function listAll($projectId, $page = 1, $perPage = 25)
40 40
     {
41 41
         if (!is_int($projectId)) {
42 42
             throw new Exception("Integer project ID expected, while got '$projectId'");
43 43
         }
44 44
         
45
-        if ($projectId<0) {
45
+        if ($projectId < 0) {
46 46
             throw new Exception("Expected positive integer project ID");
47 47
         }
48 48
         
49
-        if ($page<0) {
49
+        if ($page < 0) {
50 50
             throw new Exception('Invalid page number passed');
51 51
         }
52 52
         
53
-        if ($perPage<0) {
53
+        if ($perPage < 0) {
54 54
             throw new Exception('Invalid page size passed');
55 55
         }
56 56
         
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                     Exception::CODE_INVALID_ARG);
107 107
         }
108 108
         
109
-        if ($campaignId<0) {
109
+        if ($campaignId < 0) {
110 110
             throw new Exception("Expected positive integer campaign ID",
111 111
                     Exception::CODE_INVALID_ARG);
112 112
         }
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Metric.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@
 block discarded – undo
51 51
         // Remove options with empty values
52 52
         $cleanedOptions = array();
53 53
         foreach ($options as $name=>$value) {
54
-            if ($value!==null)
55
-                $cleanedOptions[$name] = $value;
54
+            if ($value!==null) {
55
+                            $cleanedOptions[$name] = $value;
56
+            }
56 57
         }
57 58
         
58 59
         return $cleanedOptions;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
                 case 'variation_id': $this->setVariationId($value); break;
50 50
                 case 'variation_reach': $this->setVariationReach($value); break;
51 51
                 default:
52
-                    throw new Exception('Unknown option: ' . $name);
52
+                    throw new Exception('Unknown option: '.$name);
53 53
             }
54 54
         }
55 55
     }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         // Remove options with empty values
70 70
         $cleanedOptions = array();
71 71
         foreach ($options as $name=>$value) {
72
-            if ($value!==null)
72
+            if ($value !== null)
73 73
                 $cleanedOptions[$name] = $value;
74 74
         }
75 75
         
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
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
 function load_credentials_from_file()
14 14
 {
15 15
     // Get OAuth 2.0 credentials from auth_credentials.json file.
16
-    $credentials = file_get_contents(dirname(__FILE__) . '/auth_credentials.json');
17
-    if ($credentials===false) {
18
-        throw new \Exception("Couldn't read OAuth credentials from auth_credentials.json. Make sure " .
16
+    $credentials = file_get_contents(dirname(__FILE__).'/auth_credentials.json');
17
+    if ($credentials === false) {
18
+        throw new \Exception("Couldn't read OAuth credentials from auth_credentials.json. Make sure ".
19 19
              "the file exists (if not, copy from auth_credentials.json.dist).");
20 20
     }
21 21
 
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
     }
26 26
 
27 27
     // Try to read access_token.json and merge it with the rest of credentials.
28
-    if (is_readable(dirname(__FILE__) . '/access_token.json')) {
29
-        $accessToken = file_get_contents(dirname(__FILE__) . '/access_token.json');
28
+    if (is_readable(dirname(__FILE__).'/access_token.json')) {
29
+        $accessToken = file_get_contents(dirname(__FILE__).'/access_token.json');
30 30
 
31 31
         $accessToken = json_decode($accessToken, true);
32 32
         if (!is_array($accessToken)) {
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
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
         $result = $audiencesService->listAll(1000);
50 50
         $audiences = $result->getPayload();
51 51
         
52
-        $this->assertTrue(count($audiences)==1);
52
+        $this->assertTrue(count($audiences) == 1);
53 53
         $this->assertTrue($audiences[0] instanceOf Audience);
54
-        $this->assertTrue($audiences[0]->getName()=='Spanish speaking San Franciscans');        
54
+        $this->assertTrue($audiences[0]->getName() == 'Spanish speaking San Franciscans');        
55 55
     }
56 56
     
57 57
     public function testGet()
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $audience = $result->getPayload();
93 93
         
94 94
         $this->assertTrue($audience instanceOf Audience);
95
-        $this->assertTrue($audience->getName()=='Spanish speaking San Franciscans');        
95
+        $this->assertTrue($audience->getName() == 'Spanish speaking San Franciscans');        
96 96
     }
97 97
     
98 98
     public function testCreate()
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         $createdAudience = $result->getPayload();
153 153
         
154 154
         $this->assertTrue($createdAudience instanceOf Audience);
155
-        $this->assertTrue($createdAudience->getName()=='Spanish speaking San Franciscans');                
155
+        $this->assertTrue($createdAudience->getName() == 'Spanish speaking San Franciscans');                
156 156
     }
157 157
     
158 158
     public function testUpdate()
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         $createdAudience = $result->getPayload();
213 213
         
214 214
         $this->assertTrue($createdAudience instanceOf Audience);
215
-        $this->assertTrue($createdAudience->getName()=='Spanish speaking San Franciscans');                
215
+        $this->assertTrue($createdAudience->getName() == 'Spanish speaking San Franciscans');                
216 216
     }
217 217
 }
218 218
 
Please login to merge, or discard this patch.
tests/OptimizelyPHPTest/Service/v2/ExperimentsTest.php 2 patches
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.
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
                         ), 200);
103 103
         
104 104
         $optimizelyApiClientMock->method('sendApiRequest')
@@ -124,20 +124,20 @@  discard block
 block discarded – undo
124 124
         $result = new Result(array(
125 125
                             "project_id" => 1000,
126 126
                             "audience_ids" => array(
127
-                              1234,
128
-                              1212,
129
-                              1432
127
+                                1234,
128
+                                1212,
129
+                                1432
130 130
                             ),
131 131
                             "campaign_id" => 2000,
132 132
                             "changes" => array(
133
-                              array(
133
+                                array(
134 134
                                 "type" => "custom_code",
135 135
                                 "allow_additional_redirect" => true,
136 136
                                 "async" => true,
137 137
                                 "css_selector" => "a[href*=\"optimizely\"]",
138 138
                                 "dependencies" => array(
139
-                                  24,
140
-                                  26
139
+                                    24,
140
+                                    26
141 141
                                 ),
142 142
                                 "destination" => "https://app.optimizely.com/",
143 143
                                 "extension_id" => 1234,
@@ -145,37 +145,37 @@  discard block
 block discarded – undo
145 145
                                 "src" => 524,
146 146
                                 "value" => "window.someGlobalFunction();",
147 147
                                 "id" => "string"
148
-                              )
148
+                                )
149 149
                             ),
150 150
                             "description" => "string",
151 151
                             "holdback" => 5000,
152 152
                             "key" => "home_page_experiment",
153 153
                             "metrics" => array(
154
-                              array(
154
+                                array(
155 155
                                 "kind" => "string",
156 156
                                 "id" => 0
157
-                              )
157
+                                )
158 158
                             ),
159 159
                             "name" => "Blue Button Experiment",
160 160
                             "schedule" => array(
161
-                              "start_time" => "2016-10-17T07:05:00.070Z",
162
-                              "stop_time" => "2016-10-17T07:05:00.070Z",
163
-                              "time_zone" => "UTC"
161
+                                "start_time" => "2016-10-17T07:05:00.070Z",
162
+                                "stop_time" => "2016-10-17T07:05:00.070Z",
163
+                                "time_zone" => "UTC"
164 164
                             ),
165 165
                             "status" => "active",
166 166
                             "variations" => array(
167
-                              array(
167
+                                array(
168 168
                                 "actions" => array(
169
-                                  array(
169
+                                    array(
170 170
                                     "changes" => array(
171
-                                      array(
171
+                                        array(
172 172
                                         "type" => "custom_code",
173 173
                                         "allow_additional_redirect" => true, 
174 174
                                         "async" => true,
175 175
                                         "css_selector" => "a[href*=\"optimizely\"]",
176 176
                                         "dependencies" => array(
177
-                                          24,
178
-                                          26
177
+                                            24,
178
+                                            26
179 179
                                         ),
180 180
                                         "destination" => "https://app.optimizely.com/",
181 181
                                         "extension_id" => 1234,
@@ -183,23 +183,23 @@  discard block
 block discarded – undo
183 183
                                         "src" => 524,
184 184
                                         "value" => "window.someGlobalFunction();",
185 185
                                         "id" => "string"
186
-                                      )
186
+                                        )
187 187
                                     ),
188 188
                                     "page_id" => 0
189
-                                  )
189
+                                    )
190 190
                                 ),
191 191
                                 "archived"=> true,
192 192
                                 "key" => "blue_button_variation",
193 193
                                 "name" => "Blue Button",
194 194
                                 "variation_id" => 0,
195 195
                                 "weight" => 0
196
-                              )
196
+                                )
197 197
                             ),
198 198
                             "created" => "2016-10-17T07:05:00.070Z",
199 199
                             "id" => 3000,
200 200
                             "is_classic" => false,
201 201
                             "last_modified" => "2016-10-17T07:05:00.070Z"
202
-                          ), 200);
202
+                            ), 200);
203 203
         
204 204
         $optimizelyApiClientMock->method('sendApiRequest')
205 205
                     ->willReturn($result);
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
                             "end_time" => "2016-10-17T07:05:00.089Z",
226 226
                             "experiment_id" => 3000,
227 227
                             "metrics" => array(
228
-                              array(
228
+                                array(
229 229
                                 "event" => "string",
230 230
                                 "event_name" => "string",
231 231
                                 "measure" => "conversions",
@@ -233,54 +233,54 @@  discard block
 block discarded – undo
233 233
                                 "priority" => 1,
234 234
                                 "unit" => "session",
235 235
                                 "variation_results" => array(
236
-                                  "9000" => array(
236
+                                    "9000" => array(
237 237
                                     "experiment_id" => 0,
238 238
                                     "is_baseline" => true,
239 239
                                     "lift" => array(
240
-                                      "confidence_interval" => array(
240
+                                        "confidence_interval" => array(
241 241
                                         0.010399560300730457,
242 242
                                         0.0850821459929161
243
-                                      ),
244
-                                      "is_most_conclusive" => true,
245
-                                      "is_significant" => true,
246
-                                      "significance" => 0,
247
-                                      "value" => 0,
248
-                                      "visitors_remaining" => 0
243
+                                        ),
244
+                                        "is_most_conclusive" => true,
245
+                                        "is_significant" => true,
246
+                                        "significance" => 0,
247
+                                        "value" => 0,
248
+                                        "visitors_remaining" => 0
249 249
                                     ),
250 250
                                     "name" => "Blue Button",
251 251
                                     "rate" => 0,
252 252
                                     "scope" => "variation",
253 253
                                     "total_increase" => array(
254
-                                      "confidence_interval" => array(
254
+                                        "confidence_interval" => array(
255 255
                                         0.010399560300730457,
256 256
                                         0.0850821459929161
257
-                                      ),
258
-                                      "is_most_conclusive" => true,
259
-                                      "is_significant" => true,
260
-                                      "significance" => 0,
261
-                                      "value" => 0,
262
-                                      "visitors_remaining" => 0
257
+                                        ),
258
+                                        "is_most_conclusive" => true,
259
+                                        "is_significant" => true,
260
+                                        "significance" => 0,
261
+                                        "value" => 0,
262
+                                        "visitors_remaining" => 0
263 263
                                     ),
264 264
                                     "value" => 0,
265 265
                                     "variation_id" => "string"
266
-                                  )
266
+                                    )
267
+                                )
267 268
                                 )
268
-                              )
269 269
                             ),
270 270
                             "reach" => array(
271
-                              "baseline_count" => 0,
272
-                              "baseline_reach" => 0,
273
-                              "total_count" => 0,
274
-                              "treatment_count" => 0,
275
-                              "treatment_reach" => 0,
276
-                              "variations" => array(
271
+                                "baseline_count" => 0,
272
+                                "baseline_reach" => 0,
273
+                                "total_count" => 0,
274
+                                "treatment_count" => 0,
275
+                                "treatment_reach" => 0,
276
+                                "variations" => array(
277 277
                                 "9000" => array(
278
-                                  "count" => 0,
279
-                                  "name" => "Blue Button",
280
-                                  "variation_id" => "string",
281
-                                  "variation_reach" => 0
278
+                                    "count" => 0,
279
+                                    "name" => "Blue Button",
280
+                                    "variation_id" => "string",
281
+                                    "variation_reach" => 0
282
+                                )
282 283
                                 )
283
-                              )
284 284
                             ),
285 285
                             "start_time" => "2016-10-17T07:05:00.090Z"
286 286
                         ), 200);
@@ -307,20 +307,20 @@  discard block
 block discarded – undo
307 307
         $result = new Result(array(
308 308
                             "project_id" => 1000,
309 309
                             "audience_ids" => array(
310
-                              1234,
311
-                              1212,
312
-                              1432
310
+                                1234,
311
+                                1212,
312
+                                1432
313 313
                             ),
314 314
                             "campaign_id" => 2000,
315 315
                             "changes" => array(
316
-                              array(
316
+                                array(
317 317
                                 "type" => "custom_code",
318 318
                                 "allow_additional_redirect" => true,
319 319
                                 "async" => true,
320 320
                                 "css_selector" => "a[href*=\"optimizely\"]",
321 321
                                 "dependencies" => array(
322
-                                  24,
323
-                                  26
322
+                                    24,
323
+                                    26
324 324
                                 ),
325 325
                                 "destination" => "https://app.optimizely.com/",
326 326
                                 "extension_id" => 1234,
@@ -328,37 +328,37 @@  discard block
 block discarded – undo
328 328
                                 "src" => 524,
329 329
                                 "value" => "window.someGlobalFunction();",
330 330
                                 "id" => "string"
331
-                              )
331
+                                )
332 332
                             ),
333 333
                             "description" => "string",
334 334
                             "holdback" => 5000,
335 335
                             "key" => "home_page_experiment",
336 336
                             "metrics" => array(
337
-                              array(
337
+                                array(
338 338
                                 "kind" => "string",
339 339
                                 "id" => 0
340
-                              )
340
+                                )
341 341
                             ),
342 342
                             "name" => "Blue Button Experiment",
343 343
                             "schedule" => array(
344
-                              "start_time" => "2016-10-17T07:05:00.099Z",
345
-                              "stop_time" => "2016-10-17T07:05:00.099Z",
346
-                              "time_zone" => "UTC"
344
+                                "start_time" => "2016-10-17T07:05:00.099Z",
345
+                                "stop_time" => "2016-10-17T07:05:00.099Z",
346
+                                "time_zone" => "UTC"
347 347
                             ),
348 348
                             "status" => "active",
349 349
                             "variations" => array(
350
-                              array(
350
+                                array(
351 351
                                 "actions" => array(
352
-                                  array(
352
+                                    array(
353 353
                                     "changes" => array(
354
-                                      array(
354
+                                        array(
355 355
                                         "type" => "custom_code",
356 356
                                         "allow_additional_redirect" => true,
357 357
                                         "async" => true,
358 358
                                         "css_selector" => "a[href*=\"optimizely\"]",
359 359
                                         "dependencies" => array(
360
-                                          24,
361
-                                          26
360
+                                            24,
361
+                                            26
362 362
                                         ),
363 363
                                         "destination" => "https://app.optimizely.com/",
364 364
                                         "extension_id" => 1234,
@@ -366,17 +366,17 @@  discard block
 block discarded – undo
366 366
                                         "src" => 524,
367 367
                                         "value" => "window.someGlobalFunction();",
368 368
                                         "id" => "string"
369
-                                      )
369
+                                        )
370 370
                                     ),
371 371
                                     "page_id" => 0
372
-                                  )
372
+                                    )
373 373
                                 ),
374 374
                                 "archived" => true,
375 375
                                 "key" => "blue_button_variation",
376 376
                                 "name" => "Blue Button",
377 377
                                 "variation_id" => 0,
378 378
                                 "weight" => 0
379
-                              )
379
+                                )
380 380
                             ),
381 381
                             "created" => "2016-10-17T07:05:00.099Z",
382 382
                             "id" => 3000,
@@ -392,73 +392,73 @@  discard block
 block discarded – undo
392 392
         $experiment = new Experiment(array(
393 393
             "project_id" => 1000,
394 394
             "audience_ids" => array(
395
-              1234,
396
-              1212,
397
-              1432
395
+                1234,
396
+                1212,
397
+                1432
398 398
             ),
399 399
             "campaign_id" => 2000,
400 400
             "changes" => array(
401
-              array(
401
+                array(
402 402
                 "type" => "custom_code",
403 403
                 "allow_additional_redirect" => true,
404 404
                 "async" => true,
405 405
                 "css_selector" => "a[href*=\"optimizely\"]",
406 406
                 "dependencies" => array(
407
-                  24,
408
-                  26
407
+                    24,
408
+                    26
409 409
                 ),
410 410
                 "destination" => "https://app.optimizely.com/",
411 411
                 "extension_id" => 1234,
412 412
                 "preserve_parameters" => true,
413 413
                 "src" => 524,
414 414
                 "value" => "window.someGlobalFunction();"
415
-              )
415
+                )
416 416
             ),
417 417
             "description" => "string",
418 418
             "holdback" => 5000,
419 419
             "key" => "home_page_experiment",
420 420
             "metrics" => array(
421
-              array(
421
+                array(
422 422
                 "kind" => "string"
423
-              )
423
+                )
424 424
             ),
425 425
             "name" => "Blue Button Experiment",
426 426
             "schedule" => array(
427
-              "start_time" => "2016-10-17T07:04:59.724Z",
428
-              "stop_time" => "2016-10-17T07:04:59.724Z",
429
-              "time_zone" => "UTC"
427
+                "start_time" => "2016-10-17T07:04:59.724Z",
428
+                "stop_time" => "2016-10-17T07:04:59.724Z",
429
+                "time_zone" => "UTC"
430 430
             ),
431 431
             "status" => "active",
432 432
             "variations" => array(
433
-              array(
433
+                array(
434 434
                 "actions" => array(
435
-                  array(
435
+                    array(
436 436
                     "changes" => array(
437
-                      array(
437
+                        array(
438 438
                         "type" => "custom_code",
439 439
                         "allow_additional_redirect" => true,
440 440
                         "async" => true,
441 441
                         "css_selector" => "a[href*=\"optimizely\"]",
442 442
                         "dependencies" => array(
443
-                          24,
444
-                          26
443
+                            24,
444
+                            26
445 445
                         ),
446 446
                         "destination" => "https://app.optimizely.com/",
447 447
                         "extension_id" => 1234,
448 448
                         "preserve_parameters" => true,
449 449
                         "src" => 524,
450 450
                         "value" => "window.someGlobalFunction();"
451
-                      )
451
+                        )
452 452
                     ),
453 453
                     "page_id" => 0
454
-                  )
454
+                    )
455 455
                 ),
456 456
                 "archived" => true,
457 457
                 "key" => "blue_button_variation",
458 458
                 "name" => "Blue Button",
459 459
                 "variation_id" => 0,
460 460
                 "weight" => 0
461
-              )
461
+                )
462 462
             )
463 463
         ));
464 464
         
@@ -479,20 +479,20 @@  discard block
 block discarded – undo
479 479
         $result = new Result(array(
480 480
                         "project_id" => 1000,
481 481
                         "audience_ids" => array(
482
-                          1234,
483
-                          1212,
484
-                          1432
482
+                            1234,
483
+                            1212,
484
+                            1432
485 485
                         ),
486 486
                         "campaign_id" => 2000,
487 487
                         "changes" => array(
488
-                          array(
488
+                            array(
489 489
                             "type" => "custom_code",
490 490
                             "allow_additional_redirect" => true,
491 491
                             "async" => true,
492 492
                             "css_selector" => "a[href*=\"optimizely\"]",
493 493
                             "dependencies" => array(
494
-                              24,
495
-                              26
494
+                                24,
495
+                                26
496 496
                             ),
497 497
                             "destination" => "https://app.optimizely.com/",
498 498
                             "extension_id" => 1234,
@@ -500,37 +500,37 @@  discard block
 block discarded – undo
500 500
                             "src" => 524,
501 501
                             "value" => "window.someGlobalFunction();",
502 502
                             "id" => "string"
503
-                          )
503
+                            )
504 504
                         ),
505 505
                         "description" => "string",
506 506
                         "holdback" => 5000,
507 507
                         "key" => "home_page_experiment",
508 508
                         "metrics" => array(
509
-                          array(
509
+                            array(
510 510
                             "kind" => "string",
511 511
                             "id" => 0
512
-                          )
512
+                            )
513 513
                         ),
514 514
                         "name" => "Blue Button Experiment",
515 515
                         "schedule" => array(
516
-                          "start_time" => "2016-10-17T07:05:00.109Z",
517
-                          "stop_time" => "2016-10-17T07:05:00.109Z",
518
-                          "time_zone" => "UTC"
516
+                            "start_time" => "2016-10-17T07:05:00.109Z",
517
+                            "stop_time" => "2016-10-17T07:05:00.109Z",
518
+                            "time_zone" => "UTC"
519 519
                         ),
520 520
                         "status" => "active",
521 521
                         "variations" => array(
522
-                          array(
522
+                            array(
523 523
                             "actions" => array(
524
-                              array(
524
+                                array(
525 525
                                 "changes" => array(
526
-                                  array(
526
+                                    array(
527 527
                                     "type" => "custom_code",
528 528
                                     "allow_additional_redirect" => true,
529 529
                                     "async" => true,
530 530
                                     "css_selector" => "a[href*=\"optimizely\"]",
531 531
                                     "dependencies" => array(
532
-                                      24,
533
-                                      26
532
+                                        24,
533
+                                        26
534 534
                                     ),
535 535
                                     "destination" => "https://app.optimizely.com/",
536 536
                                     "extension_id" => 1234,
@@ -538,17 +538,17 @@  discard block
 block discarded – undo
538 538
                                     "src" => 524,
539 539
                                     "value" => "window.someGlobalFunction();",
540 540
                                     "id" => "string"
541
-                                  )
541
+                                    )
542 542
                                 ),
543 543
                                 "page_id" => 0
544
-                              )
544
+                                )
545 545
                             ),
546 546
                             "archived" => true,
547 547
                             "key" => "blue_button_variation",
548 548
                             "name" => "Blue Button",
549 549
                             "variation_id" => 0,
550 550
                             "weight" => 0
551
-                          )
551
+                            )
552 552
                         ),
553 553
                         "created" => "2016-10-17T07:05:00.109Z",
554 554
                         "id" => 3000,
@@ -562,72 +562,72 @@  discard block
 block discarded – undo
562 562
         $experimentsService = new Experiments($optimizelyApiClientMock);
563 563
         
564 564
         $experiment = new Experiment(array(
565
-              "audience_ids" => array(
565
+                "audience_ids" => array(
566 566
                 0
567
-              ),
568
-              "changes" => array(
567
+                ),
568
+                "changes" => array(
569 569
                 array(
570
-                  "type" => "custom_code",
571
-                  "allow_additional_redirect" => true,
572
-                  "async" => true,
573
-                  "css_selector" => "a[href*=\"optimizely\"]",
574
-                  "dependencies" => array(
570
+                    "type" => "custom_code",
571
+                    "allow_additional_redirect" => true,
572
+                    "async" => true,
573
+                    "css_selector" => "a[href*=\"optimizely\"]",
574
+                    "dependencies" => array(
575 575
                     24,
576 576
                     26
577
-                  ),
578
-                  "destination" => "https://app.optimizely.com/",
579
-                  "extension_id" => 1234,
580
-                  "preserve_parameters" => true,
581
-                  "src" => 524,
582
-                  "value" => "window.someGlobalFunction();"
577
+                    ),
578
+                    "destination" => "https://app.optimizely.com/",
579
+                    "extension_id" => 1234,
580
+                    "preserve_parameters" => true,
581
+                    "src" => 524,
582
+                    "value" => "window.someGlobalFunction();"
583 583
                 )
584
-              ),
585
-              "description" => "AB Test to see if the Blue Button converts more visitors",
586
-              "holdback" => 0,
587
-              "key" => "home_page_experiment",
588
-              "metrics" => array(
584
+                ),
585
+                "description" => "AB Test to see if the Blue Button converts more visitors",
586
+                "holdback" => 0,
587
+                "key" => "home_page_experiment",
588
+                "metrics" => array(
589 589
                 array(
590
-                  "kind" => "string"
590
+                    "kind" => "string"
591 591
                 )
592
-              ),
593
-              "name" => "Blue Button Experiment",
594
-              "schedule" => array(
592
+                ),
593
+                "name" => "Blue Button Experiment",
594
+                "schedule" => array(
595 595
                 "start_time" => "2016-10-17T07:04:59.731Z",
596 596
                 "stop_time" => "2016-10-17T07:04:59.731Z",
597 597
                 "time_zone" => "UTC"
598
-              ),
599
-              "status" => "active",
600
-              "variations" => array(
598
+                ),
599
+                "status" => "active",
600
+                "variations" => array(
601 601
                 array(
602
-                  "actions" => array(
602
+                    "actions" => array(
603 603
                     array(
604
-                      "changes" => array(
604
+                        "changes" => array(
605 605
                         array(
606
-                          "type" => "custom_code",
607
-                          "allow_additional_redirect" => true,
608
-                          "async" => true,
609
-                          "css_selector" => "a[href*=\"optimizely\"]",
610
-                          "dependencies" => array(
606
+                            "type" => "custom_code",
607
+                            "allow_additional_redirect" => true,
608
+                            "async" => true,
609
+                            "css_selector" => "a[href*=\"optimizely\"]",
610
+                            "dependencies" => array(
611 611
                             24,
612 612
                             26
613
-                          ),
614
-                          "destination" => "https://app.optimizely.com/",
615
-                          "extension_id" => 1234,
616
-                          "preserve_parameters" => true,
617
-                          "src" => 524,
618
-                          "value" => "window.someGlobalFunction();"
613
+                            ),
614
+                            "destination" => "https://app.optimizely.com/",
615
+                            "extension_id" => 1234,
616
+                            "preserve_parameters" => true,
617
+                            "src" => 524,
618
+                            "value" => "window.someGlobalFunction();"
619 619
                         )
620
-                      ),
621
-                      "page_id" => 0
620
+                        ),
621
+                        "page_id" => 0
622 622
                     )
623
-                  ),
624
-                  "archived" => true,
625
-                  "key" => "blue_button_variation",
626
-                  "name" => "Blue Button",
627
-                  "variation_id" => 0,
628
-                  "weight" => 0
623
+                    ),
624
+                    "archived" => true,
625
+                    "key" => "blue_button_variation",
626
+                    "name" => "Blue Button",
627
+                    "variation_id" => 0,
628
+                    "weight" => 0
629
+                )
629 630
                 )
630
-              )
631 631
         ));
632 632
         
633 633
         $result = $experimentsService->update(1000, $experiment, true, true);
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.