Completed
Push — master ( 90835e...e5901e )
by Oleg
02:50
created
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/ExperimentVariationReach.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
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
                     break;                
72 72
                 }
73 73
                 default:
74
-                    throw new Exception('Unknown option: ' . $name);
74
+                    throw new Exception('Unknown option: '.$name);
75 75
             }
76 76
         }
77 77
     }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         // Remove options with empty values
98 98
         $cleanedOptions = array();
99 99
         foreach ($options as $name=>$value) {
100
-            if ($value!==null)
100
+            if ($value !== null)
101 101
                 $cleanedOptions[$name] = $value;
102 102
         }
103 103
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Experiment.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   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
                 case 'id': $this->setId($value); break;
162 162
                 case 'is_classic': $this->setIsClassic($value); break;                
163 163
                 default:
164
-                    throw new Exception('Unknown option: ' . $name);
164
+                    throw new Exception('Unknown option: '.$name);
165 165
             }
166 166
         }
167 167
     }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
             'last_modified' => $this->getLastModified(),
184 184
             'metrics' => array(),
185 185
             'name' => $this->getName(),
186
-            'schedule' => $this->getSchedule()?$this->getSchedule()->toArray():null,
186
+            'schedule' => $this->getSchedule() ? $this->getSchedule()->toArray() : null,
187 187
             'status' => $this->getStatus(),
188 188
             'variations' => array(),
189 189
             'id' => $this->getId(),
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         // Remove options with empty values
206 206
         $cleanedOptions = array();
207 207
         foreach ($options as $name=>$value) {
208
-            if ($value!==null)
208
+            if ($value !== null)
209 209
                 $cleanedOptions[$name] = $value;
210 210
         }
211 211
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Event.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   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
                 case 'is_classic': $this->setIsClassic($value); break;
125 125
                 case 'is_editable': $this->setIsEditable($value); break;
126 126
                 default:
127
-                    throw new Exception('Unknown option: ' . $name);
127
+                    throw new Exception('Unknown option: '.$name);
128 128
             }
129 129
         }
130 130
     }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
             'category' => $this->getCategory(),
141 141
             'created' => $this->getCreated(),
142 142
             'description' => $this->getDescription(),
143
-            'event_filter' => $this->getEventFilter()?$this->getEventFilter()->toArray():null,
143
+            'event_filter' => $this->getEventFilter() ? $this->getEventFilter()->toArray() : null,
144 144
             'event_type' => $this->getEventType(),
145 145
             'key' => $this->getKey(),
146 146
             'name' => $this->getName(),
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         // Remove options with empty values
155 155
         $cleanedOptions = array();
156 156
         foreach ($options as $name=>$value) {
157
-            if ($value!==null)
157
+            if ($value !== null)
158 158
                 $cleanedOptions[$name] = $value;
159 159
         }
160 160
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/VariantResults.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   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                 case 'value': $this->setValue($value); break;
89 89
                 case 'variation_id': $this->setVariationId($value); break;
90 90
                 default:
91
-                    throw new Exception('Unknown option: ' . $name);
91
+                    throw new Exception('Unknown option: '.$name);
92 92
             }
93 93
         }
94 94
     }
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
         $options = array(
102 102
             'experiment_id' => $this->getExperimentId(),
103 103
             'is_baseline' => $this->getIsBaseline(),
104
-            'lift' => $this->getLift()?$this->getLift()->toArray():null,
104
+            'lift' => $this->getLift() ? $this->getLift()->toArray() : null,
105 105
             'name' => $this->getName(),
106 106
             'rate' => $this->getRate(),
107 107
             'scope' => $this->getScope(),
108
-            'total_increase' => $this->getTotalIncrease()?$this->getTotalIncrease()->toArray():null,
108
+            'total_increase' => $this->getTotalIncrease() ? $this->getTotalIncrease()->toArray() : null,
109 109
             'value' => $this->getValue(),
110 110
             'variation_id' => $this->getVariationId()
111 111
         );
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         // Remove options with empty values
114 114
         $cleanedOptions = array();
115 115
         foreach ($options as $name=>$value) {
116
-            if ($value!==null)
116
+            if ($value !== null)
117 117
                 $cleanedOptions[$name] = $value;
118 118
         }
119 119
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Campaign.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
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
                 case 'type': $this->setType($value); break;
135 135
                 case 'id': $this->setId($value); break;
136 136
                 default:
137
-                    throw new Exception('Unknown option: ' . $name);
137
+                    throw new Exception('Unknown option: '.$name);
138 138
             }
139 139
         }
140 140
     }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         // Remove options with empty values
173 173
         $cleanedOptions = array();
174 174
         foreach ($options as $name=>$value) {
175
-            if ($value!==null)
175
+            if ($value !== null)
176 176
                 $cleanedOptions[$name] = $value;
177 177
         }
178 178
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Exception.php 2 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -82,7 +82,6 @@  discard block
 block discarded – undo
82 82
             
83 83
     /**
84 84
      * Set HTTP response code.
85
-     * @param integer $code
86 85
      */
87 86
     public function setHttpCode($httpCode)
88 87
     {
@@ -100,7 +99,6 @@  discard block
 block discarded – undo
100 99
             
101 100
     /**
102 101
      * Set message
103
-     * @param string $message
104 102
      */
105 103
     public function setUuid($uuid)
106 104
     {
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -55,20 +55,25 @@
 block discarded – undo
55 55
     {
56 56
         parent::__construct($message, $code);
57 57
         
58
-        if (isset($options['http_code']))
59
-            $this->setHttpCode($options['http_code']);
58
+        if (isset($options['http_code'])) {
59
+                    $this->setHttpCode($options['http_code']);
60
+        }
60 61
                 
61
-        if (isset($options['uuid']))
62
-            $this->setUuid($options['uuid']);
62
+        if (isset($options['uuid'])) {
63
+                    $this->setUuid($options['uuid']);
64
+        }
63 65
         
64
-        if (isset($options['rate_limit']))
65
-            $this->setRateLimit($options['rate_limit']);
66
+        if (isset($options['rate_limit'])) {
67
+                    $this->setRateLimit($options['rate_limit']);
68
+        }
66 69
         
67
-        if (isset($options['rate_limit_remaining']))
68
-            $this->setRateLimitRemaining($options['rate_limit_remaining']);
70
+        if (isset($options['rate_limit_remaining'])) {
71
+                    $this->setRateLimitRemaining($options['rate_limit_remaining']);
72
+        }
69 73
         
70
-        if (isset($options['rate_limit_reset']))
71
-            $this->setRateLimitReset($options['rate_limit_reset']);
74
+        if (isset($options['rate_limit_reset'])) {
75
+                    $this->setRateLimitReset($options['rate_limit_reset']);
76
+        }
72 77
     }
73 78
     
74 79
     /**
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/OptimizelyApiClient.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      * @param array $queryParams The list of query parameters.
164 164
      * @param string $method HTTP method (GET or POST).
165 165
      * @param array $postData Data send in request body (only for POST method).
166
-     * @return array Optimizely response in form of array.
166
+     * @return Result Optimizely response in form of array.
167 167
      * @throws Exception
168 168
      */
169 169
     public function sendApiRequest($url, $queryParams = array(), $method='GET', 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      * @param array $queryParams The list of query parameters.
189 189
      * @param string $method HTTP method (GET or POST).
190 190
      * @param array $postData Data send in request body (only for POST method).
191
-     * @return array Optimizely response in form of array.
191
+     * @return Result Optimizely response in form of array.
192 192
      * @throws Exception
193 193
      */
194 194
     private function sendHttpRequest($url, $queryParams = array(), $method='GET', 
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
      * @param array $authCredentials Auth credentials.
51 51
      * @param string $apiVersion Optional. Currently supported 'v2' only.     
52 52
      */
53
-    public function __construct($authCredentials, $apiVersion='v2')
53
+    public function __construct($authCredentials, $apiVersion = 'v2')
54 54
     {
55 55
         if (!is_array($authCredentials)) {
56 56
             throw new Exception('Auth credentials must be an array');            
57 57
         }
58 58
         
59
-        if ($apiVersion!='v2') {
59
+        if ($apiVersion != 'v2') {
60 60
             throw new Exception('Invalid API version passed');
61 61
         }
62 62
         
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      */
86 86
     public function setApiVersion($apiVersion)
87 87
     {
88
-        if ($apiVersion!='v2') {
88
+        if ($apiVersion != 'v2') {
89 89
             throw new Exception('Invalid API version passed');
90 90
         }
91 91
         
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function setAuthCredentials($authCredentials)
109 109
     {
110
-        if (!is_array($authCredentials) || count($authCredentials)==0) {
110
+        if (!is_array($authCredentials) || count($authCredentials) == 0) {
111 111
             throw new Exception('Auth credentials must be an array');            
112 112
         }
113 113
         
@@ -166,16 +166,16 @@  discard block
 block discarded – undo
166 166
      * @return array Optimizely response in form of array.
167 167
      * @throws Exception
168 168
      */
169
-    public function sendApiRequest($url, $queryParams = array(), $method='GET', 
169
+    public function sendApiRequest($url, $queryParams = array(), $method = 'GET', 
170 170
             $postData = array())
171 171
     {
172 172
         // If access token has expired, try to get another one with refresh token.
173
-        if ($this->isAccessTokenExpired() && $this->getRefreshToken()!=null) {
173
+        if ($this->isAccessTokenExpired() && $this->getRefreshToken() != null) {
174 174
             $this->getAccessTokenByRefreshToken();
175 175
         }
176 176
         
177 177
         // Produce absolute URL
178
-        $url = 'https://api.optimizely.com/' . $this->apiVersion . $url;
178
+        $url = 'https://api.optimizely.com/'.$this->apiVersion.$url;
179 179
         
180 180
         $result = $this->sendHttpRequest($url, $queryParams, $method, $postData);
181 181
         
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      * @return array Optimizely response in form of array.
192 192
      * @throws Exception
193 193
      */
194
-    private function sendHttpRequest($url, $queryParams = array(), $method='GET', 
194
+    private function sendHttpRequest($url, $queryParams = array(), $method = 'GET', 
195 195
             $postData = array())
196 196
     {
197 197
         // Reset diagnostics info.
@@ -199,41 +199,41 @@  discard block
 block discarded – undo
199 199
         
200 200
         // Check if CURL is initialized (it should have been initialized in 
201 201
         // constructor).
202
-        if ($this->curlHandle==false) {
202
+        if ($this->curlHandle == false) {
203 203
             throw new Exception('CURL is not initialized', 
204 204
                     Exception::CODE_CURL_ERROR);
205 205
         }
206 206
         
207
-        if ($method!='GET' && $method!='POST' && $method!='PUT' && 
208
-            $method!='PATCH' && $method!='DELETE') {
209
-            throw new Exception('Invalid HTTP method passed: ' . $method);
207
+        if ($method != 'GET' && $method != 'POST' && $method != 'PUT' && 
208
+            $method != 'PATCH' && $method != 'DELETE') {
209
+            throw new Exception('Invalid HTTP method passed: '.$method);
210 210
         }
211 211
         
212 212
         if (!isset($this->authCredentials['access_token'])) {
213
-            throw new Exception('OAuth access token is not set. You should pass ' . 
213
+            throw new Exception('OAuth access token is not set. You should pass '. 
214 214
                     'it to the class constructor when initializing the Optimizely client.');
215 215
         }
216 216
                 
217 217
         // Append query parameters to URL.
218
-        if (count($queryParams)!=0) {            
218
+        if (count($queryParams) != 0) {            
219 219
             $query = http_build_query($queryParams);
220
-            $url .= '?' . $query;
220
+            $url .= '?'.$query;
221 221
         }
222 222
         
223 223
         $headers = array(
224
-            "Authorization: Bearer " . $this->authCredentials['access_token'],
224
+            "Authorization: Bearer ".$this->authCredentials['access_token'],
225 225
             "Content-Type: application/json"
226 226
             );
227 227
         $content = '';
228
-        if (count($postData)!=0) {
228
+        if (count($postData) != 0) {
229 229
             $content = json_encode($postData);            
230 230
         }
231
-        $headers[] = "Content-length:" . strlen($content);            
231
+        $headers[] = "Content-length:".strlen($content);            
232 232
         
233 233
         // Set HTTP options.
234 234
         curl_setopt($this->curlHandle, CURLOPT_URL, $url);
235 235
         curl_setopt($this->curlHandle, CURLOPT_CUSTOMREQUEST, $method);        
236
-        if (count($postData)!=0) {
236
+        if (count($postData) != 0) {
237 237
             curl_setopt($this->curlHandle, CURLOPT_POSTFIELDS, $content);            
238 238
         }
239 239
         curl_setopt($this->curlHandle, CURLOPT_RETURNTRANSFER, true);
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         if ($result === false) {
252 252
             $code = curl_errno($this->curlHandle);
253 253
             $error = curl_error($this->curlHandle);
254
-            throw new Exception("Failed to send HTTP request $method '$url', " . 
254
+            throw new Exception("Failed to send HTTP request $method '$url', ". 
255 255
                     "the error code was $code, error message was: '$error'", 
256 256
                     Exception::CODE_CURL_ERROR, $code, $error);
257 257
         }        
@@ -265,12 +265,12 @@  discard block
 block discarded – undo
265 265
         $headers = explode("\n", $headers);
266 266
         $parsedHeaders = array();
267 267
         foreach ($headers as $i=>$header) {
268
-            if ($i==0)
268
+            if ($i == 0)
269 269
                 continue; // Skip first line (http code).
270 270
             $pos = strpos($header, ':');
271
-            if ($pos!=false) {
271
+            if ($pos != false) {
272 272
                 $headerName = trim(strtolower(substr($header, 0, $pos)));
273
-                $headerValue = trim(substr($header, $pos+1));
273
+                $headerValue = trim(substr($header, $pos + 1));
274 274
                 $parsedHeaders[$headerName] = $headerValue;
275 275
             }
276 276
         }
@@ -302,21 +302,21 @@  discard block
 block discarded – undo
302 302
         
303 303
         // JSON-decode payload.
304 304
         $decodedPayload = json_decode($body, true);
305
-        if ($decodedPayload===false) {
306
-            throw new Exception('Could not JSON-decode the Optimizely API response. Request was ' . 
307
-                    $method . ' "' . $url . '". The response was: "' . $body . '"',
305
+        if ($decodedPayload === false) {
306
+            throw new Exception('Could not JSON-decode the Optimizely API response. Request was '. 
307
+                    $method.' "'.$url.'". The response was: "'.$body.'"',
308 308
                     Exception::CODE_API_ERROR, array('http_code'=>$httpCode));
309 309
         }
310 310
         
311 311
         // Check HTTP response code.
312
-        if ($httpCode<200 || $httpCode>299) {
312
+        if ($httpCode < 200 || $httpCode > 299) {
313 313
             
314 314
             if (!isset($decodedPayload['message']) || 
315 315
                 !isset($decodedPayload['code']) ||
316 316
                 !isset($decodedPayload['uuid']) ||
317 317
                 $httpCode != !isset($decodedPayload['code'])) {
318
-                throw new Exception('Optimizely API responded with error code ' . $httpCode . 
319
-                    ', but response format was unexpected. Request was ' . $method . ' "' . $url . '". Response was "' . $body . '"',
318
+                throw new Exception('Optimizely API responded with error code '.$httpCode. 
319
+                    ', but response format was unexpected. Request was '.$method.' "'.$url.'". Response was "'.$body.'"',
320 320
                     Exception::CODE_API_ERROR, array(
321 321
                         'http_code' => $httpCode,
322 322
                         'rate_limit' => $rateLimit,
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
             $matched = preg_match_all('/<(.+)>;\s+rel=(\w+)(,|\z)/U', 
349 349
                     $parsedHeaders['link'], $matches, PREG_SET_ORDER);
350 350
             if (!$matched) {
351
-                throw new Exception('Error parsing LINK header: ' . 
351
+                throw new Exception('Error parsing LINK header: '. 
352 352
                         $parsedHeaders['link'], Exception::CODE_API_ERROR, $httpCode);
353 353
             }
354 354
             
@@ -358,22 +358,22 @@  discard block
 block discarded – undo
358 358
                 $rel = $match[2];
359 359
                 
360 360
                 $matched = preg_match('/page=(\d+)/U', $url, $pageMatches);
361
-                if (!$matched || count($pageMatches)!=2) {
362
-                    throw new Exception('Error extracting page argument while parsing LINK header: ' . 
361
+                if (!$matched || count($pageMatches) != 2) {
362
+                    throw new Exception('Error extracting page argument while parsing LINK header: '. 
363 363
                             $parsedHeaders['link'], Exception::CODE_API_ERROR, 
364 364
                             array('http_code'=>$httpCode));
365 365
                 }
366 366
                 
367 367
                 $pageNumber = $pageMatches[1];
368 368
                 
369
-                if ($rel=='prev') {
369
+                if ($rel == 'prev') {
370 370
                     $result->setPrevPage($pageNumber);
371
-                } else if ($rel=='next') {
371
+                } else if ($rel == 'next') {
372 372
                     $result->setNextPage($pageNumber);
373
-                } else if ($rel=='last') {
373
+                } else if ($rel == 'last') {
374 374
                     $result->setLastPage($pageNumber);
375 375
                 } else {
376
-                    throw new Exception('Unexpected rel argument while parsing LINK header: ' . 
376
+                    throw new Exception('Unexpected rel argument while parsing LINK header: '. 
377 377
                             $parsedHeaders['link'], Exception::CODE_API_ERROR, 
378 378
                             array('http_code'=>$httpCode));
379 379
                 }
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
      */
392 392
     private function isAccessTokenExpired() 
393 393
     {
394
-        if(!isset($this->authCredentials['access_token'])) {
394
+        if (!isset($this->authCredentials['access_token'])) {
395 395
             return true; // We do not have access token.
396 396
         }
397 397
         
@@ -432,15 +432,15 @@  discard block
 block discarded – undo
432 432
         $clientSecret = $this->authCredentials['client_secret'];
433 433
         $refreshToken = $this->authCredentials['refresh_token'];
434 434
         
435
-        $url = "https://app.optimizely.com/oauth2/token?refresh_token=$refreshToken" . 
435
+        $url = "https://app.optimizely.com/oauth2/token?refresh_token=$refreshToken". 
436 436
                 "&client_id=$clientId&client_secret=$clientSecret&grant_type=refresh_token";
437 437
         
438 438
         $response = $this->sendHttpRequest($url, array(), 'POST');
439 439
         $decodedJsonData = $response->getDecodedJsonData();
440 440
         
441 441
         if (!isset($decodedJsonData['access_token'])) {
442
-            throw new Exception('Not found access token in response. Request URL was "' . 
443
-                    $url. '". Response was "' . print_r(json_encode($decodedJsonData), true). '"',
442
+            throw new Exception('Not found access token in response. Request URL was "'. 
443
+                    $url.'". Response was "'.print_r(json_encode($decodedJsonData), true).'"',
444 444
                     Exception::CODE_API_ERROR, $response->getHttpCode());
445 445
         }
446 446
         
Please login to merge, or discard this patch.
Braces   +13 added lines, -8 removed lines patch added patch discarded remove patch
@@ -265,8 +265,10 @@  discard block
 block discarded – undo
265 265
         $headers = explode("\n", $headers);
266 266
         $parsedHeaders = array();
267 267
         foreach ($headers as $i=>$header) {
268
-            if ($i==0)
269
-                continue; // Skip first line (http code).
268
+            if ($i==0) {
269
+                            continue;
270
+            }
271
+            // Skip first line (http code).
270 272
             $pos = strpos($header, ':');
271 273
             if ($pos!=false) {
272 274
                 $headerName = trim(strtolower(substr($header, 0, $pos)));
@@ -419,14 +421,17 @@  discard block
 block discarded – undo
419 421
      */
420 422
     private function getAccessTokenByRefreshToken()
421 423
     {
422
-        if (!isset($this->authCredentials['client_id']))
423
-            throw new Exception('OAuth 2.0 client ID is not set');
424
+        if (!isset($this->authCredentials['client_id'])) {
425
+                    throw new Exception('OAuth 2.0 client ID is not set');
426
+        }
424 427
         
425
-        if (!isset($this->authCredentials['client_secret']))
426
-            throw new Exception('OAuth 2.0 client secret is not set');
428
+        if (!isset($this->authCredentials['client_secret'])) {
429
+                    throw new Exception('OAuth 2.0 client secret is not set');
430
+        }
427 431
         
428
-        if (!isset($this->authCredentials['refresh_token']))
429
-            throw new Exception('Refresh token is not set');
432
+        if (!isset($this->authCredentials['refresh_token'])) {
433
+                    throw new Exception('Refresh token is not set');
434
+        }
430 435
         
431 436
         $clientId = $this->authCredentials['client_id'];
432 437
         $clientSecret = $this->authCredentials['client_secret'];
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Result.php 1 patch
Doc Comments   -3 removed lines patch added patch discarded remove patch
@@ -70,8 +70,6 @@  discard block
 block discarded – undo
70 70
     /**
71 71
      * Constructor.
72 72
      * @param array $decodedJsonData
73
-     * @param string $rawHttpResponseData
74
-     * @param array[string] $rawHttpResponseHeaders
75 73
      */
76 74
     public function __construct($decodedJsonData, $httpCode)
77 75
     {
@@ -90,7 +88,6 @@  discard block
 block discarded – undo
90 88
             
91 89
     /**
92 90
      * Set HTTP response code.
93
-     * @param integer $code
94 91
      */
95 92
     public function setHttpCode($httpCode)
96 93
     {
Please login to merge, or discard this patch.
tests/OptimizelyPHPTest/Service/v2/PagesTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
         $result = $pagesService->listAll(1000);
43 43
         $pages = $result->getPayload();
44 44
         
45
-        $this->assertTrue(count($pages)==1);
45
+        $this->assertTrue(count($pages) == 1);
46 46
         $this->assertTrue($pages[0] instanceOf Page);
47
-        $this->assertTrue($pages[0]->getName()=='Home Page');        
47
+        $this->assertTrue($pages[0]->getName() == 'Home Page');        
48 48
     }
49 49
     
50 50
     public function testGet()
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         $createdPage = $result->getPayload();
128 128
         
129 129
         $this->assertTrue($createdPage instanceOf Page);
130
-        $this->assertTrue($createdPage->getName()=='Home Page');                
130
+        $this->assertTrue($createdPage->getName() == 'Home Page');                
131 131
     }
132 132
     
133 133
     public function testUpdate()
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
         $updatedPage = $result->getPayload();
176 176
         
177 177
         $this->assertTrue($updatedPage instanceOf Page);
178
-        $this->assertTrue($updatedPage->getName()=='Home Page');                  
178
+        $this->assertTrue($updatedPage->getName() == 'Home Page');                  
179 179
     }
180 180
     
181 181
     public function testDelete()
Please login to merge, or discard this patch.