GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Branch Editing-Fixing (c4d168)
by Igor
03:30
created
examples/Routes/GetRoutePathPointsCompressed.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@
 block discarded – undo
33 33
     foreach ($routeResults['addresses'] as $key => $address) {
34 34
         $araddress = (array)$address;
35 35
 
36
-        if (isset($araddress['route_destination_id'])) echo "route_destination_id=".$araddress['route_destination_id']."<br>";
36
+        if (isset($araddress['route_destination_id'])) {
37
+        	echo "route_destination_id=".$araddress['route_destination_id']."<br>";
38
+        }
37 39
         
38 40
         if (isset($araddress['path_to_next'])) {
39 41
             echo "path_to_next:<br>";
Please login to merge, or discard this patch.
src/Route4Me/OptimizationProblem.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -164,7 +164,9 @@  discard block
 block discarded – undo
164 164
         
165 165
         $optimizations = array();
166 166
             foreach($json as $optimization) {
167
-                if (gettype($optimization)!="array") continue;
167
+                if (gettype($optimization)!="array") {
168
+                	continue;
169
+                }
168 170
                 
169 171
                 foreach ($optimization as $otp1) {
170 172
                     $optimizations[] = $otp1;
@@ -180,7 +182,9 @@  discard block
 block discarded – undo
180 182
     
181 183
     public function getAddresses($opt_id)
182 184
     {
183
-        if ($opt_id == null) return null;
185
+        if ($opt_id == null) {
186
+        	return null;
187
+        }
184 188
         
185 189
         $params = array( "optimization_problem_id" => $opt_id );
186 190
         
Please login to merge, or discard this patch.
src/Route4Me/Order.php 1 patch
Braces   +41 added lines, -16 removed lines patch added patch discarded remove patch
@@ -185,8 +185,12 @@  discard block
 block discarded – undo
185 185
         
186 186
         $orders = self::getOrders($params);
187 187
         
188
-        if (is_null($orders)) return null;
189
-        if (!isset($orders['results'])) return null;
188
+        if (is_null($orders)) {
189
+        	return null;
190
+        }
191
+        if (!isset($orders['results'])) {
192
+        	return null;
193
+        }
190 194
         
191 195
         $randomIndex = rand(0, sizeof($orders['results'])-1);
192 196
         
@@ -201,8 +205,12 @@  discard block
 block discarded – undo
201 205
         
202 206
         $orders = self::getOrders($params);
203 207
         
204
-        if (is_null($orders)) return null;
205
-        if (!isset($orders['results'])) return null;
208
+        if (is_null($orders)) {
209
+        	return null;
210
+        }
211
+        if (!isset($orders['results'])) {
212
+        	return null;
213
+        }
206 214
         
207 215
         $randomIndex = rand(0, sizeof($orders['results'])-1);
208 216
         
@@ -255,18 +263,26 @@  discard block
 block discarded – undo
255 263
     
256 264
     public static function validateLatitude($lat)
257 265
     {
258
-        if (!is_numeric($lat)) return false;
266
+        if (!is_numeric($lat)) {
267
+        	return false;
268
+        }
259 269
         
260
-        if ($lat>90 || $lat<-90) return false;
270
+        if ($lat>90 || $lat<-90) {
271
+        	return false;
272
+        }
261 273
         
262 274
         return true;
263 275
     }
264 276
     
265 277
     public static function validateLongitude($lng)
266 278
     {
267
-        if (!is_numeric($lng)) return false;
279
+        if (!is_numeric($lng)) {
280
+        	return false;
281
+        }
268 282
         
269
-        if ($lng>180 || $lng<-180) return false;
283
+        if ($lng>180 || $lng<-180) {
284
+        	return false;
285
+        }
270 286
         
271 287
         return true;
272 288
     }
@@ -298,8 +314,9 @@  discard block
 block discarded – undo
298 314
                     array_push($results['fail'],"$iRow --> Wrong cached_lat"); 
299 315
                     $iRow++;
300 316
                     continue;
317
+                } else {
318
+                	$cached_lat = doubleval($rows[$ordersFieldsMapping['cached_lat']]);
301 319
                 }
302
-                else $cached_lat = doubleval($rows[$ordersFieldsMapping['cached_lat']]);
303 320
                 
304 321
                 $cached_lng = 0.000;
305 322
                 
@@ -307,8 +324,9 @@  discard block
 block discarded – undo
307 324
                     array_push($results['fail'],"$iRow --> Wrong cached_lng"); 
308 325
                     $iRow++;
309 326
                     continue;
327
+                } else {
328
+                	$cached_lng = doubleval($rows[$ordersFieldsMapping['cached_lng']]);
310 329
                 }
311
-                else $cached_lng = doubleval($rows[$ordersFieldsMapping['cached_lng']]);
312 330
                 
313 331
                 if (isset($ordersFieldsMapping['curbside_lat'])) {
314 332
                     if (!$this->validateLatitude($rows[$ordersFieldsMapping['curbside_lat']])) {
@@ -328,10 +346,18 @@  discard block
 block discarded – undo
328 346
                 
329 347
                 $address = $rows[$ordersFieldsMapping['address_1']];
330 348
                 
331
-                if (isset($ordersFieldsMapping['order_city'])) $address.=', '.$rows[$ordersFieldsMapping['order_city']];
332
-                if (isset($ordersFieldsMapping['order_state_id'])) $address.=', '.$rows[$ordersFieldsMapping['order_state_id']];
333
-                if (isset($ordersFieldsMapping['order_zip_code'])) $address.=', '.$rows[$ordersFieldsMapping['order_zip_code']];
334
-                if (isset($ordersFieldsMapping['order_country_id'])) $address.=', '.$rows[$ordersFieldsMapping['order_country_id']];
349
+                if (isset($ordersFieldsMapping['order_city'])) {
350
+                	$address.=', '.$rows[$ordersFieldsMapping['order_city']];
351
+                }
352
+                if (isset($ordersFieldsMapping['order_state_id'])) {
353
+                	$address.=', '.$rows[$ordersFieldsMapping['order_state_id']];
354
+                }
355
+                if (isset($ordersFieldsMapping['order_zip_code'])) {
356
+                	$address.=', '.$rows[$ordersFieldsMapping['order_zip_code']];
357
+                }
358
+                if (isset($ordersFieldsMapping['order_country_id'])) {
359
+                	$address.=', '.$rows[$ordersFieldsMapping['order_country_id']];
360
+                }
335 361
                 
336 362
                 echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].", ".$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']]."<br>";
337 363
                 
@@ -374,8 +400,7 @@  discard block
 block discarded – undo
374 400
                 $orderResults = $order->addOrder($orderParameters);
375 401
                 
376 402
                 array_push($results['success'],"The order with order_id = ".strval($orderResults["order_id"])." added successfuly.");
377
-            }
378
-            else {
403
+            } else {
379 404
                 array_push($results['fail'],"$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); 
380 405
             }
381 406
             
Please login to merge, or discard this patch.
src/Route4Me/Route4Me.php 1 patch
Braces   +25 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,13 +34,17 @@  discard block
 block discarded – undo
34 34
         $query = isset($options['query']) ?
35 35
             array_filter($options['query']) : array();
36 36
 
37
-        if (sizeof($query)==0) return null;
37
+        if (sizeof($query)==0) {
38
+        	return null;
39
+        }
38 40
 
39 41
         $body = isset($options['body']) ?
40 42
             array_filter($options['body']) : null;
41 43
             
42 44
         $fname = isset($body['strFilename']) ? $body['strFilename'] : '';
43
-        if ($fname=='') return null;
45
+        if ($fname=='') {
46
+        	return null;
47
+        }
44 48
 
45 49
         $rpath = function_exists('curl_file_create') ? curl_file_create(realpath($fname)) : '@'.realpath($fname);
46 50
         
@@ -105,7 +109,9 @@  discard block
 block discarded – undo
105 109
         }
106 110
          
107 111
         if (isset($options['HTTPHEADERS'])) {
108
-            foreach ($options['HTTPHEADERS'] As $header) $headers[]=$header;
112
+            foreach ($options['HTTPHEADERS'] As $header) {
113
+            	$headers[]=$header;
114
+            }
109 115
         }
110 116
 
111 117
         $ch = curl_init();
@@ -158,7 +164,9 @@  discard block
 block discarded – undo
158 164
            if (isset($body)) {
159 165
                 $bodyData = json_encode($body);
160 166
                if (isset($options['HTTPHEADER'])) {
161
-                  if (strpos($options['HTTPHEADER'], "multipart/form-data")>0) $bodyData = $body;
167
+                  if (strpos($options['HTTPHEADER'], "multipart/form-data")>0) {
168
+                  	$bodyData = $body;
169
+                  }
162 170
                }
163 171
                
164 172
                curl_setopt($ch, CURLOPT_POSTFIELDS, $bodyData); 
@@ -186,14 +194,16 @@  discard block
 block discarded – undo
186 194
         if (200 == $code) {
187 195
             if ($isxml) {
188 196
                 $json = $jxml;
189
-            } else $json = json_decode($result, true);
197
+            } else {
198
+            	$json = json_decode($result, true);
199
+            }
190 200
             
191 201
             if (isset($json['errors'])) {
192 202
                 throw new ApiError(implode(', ', $json['errors']));
193 203
             } else {
194 204
                 return $json;
195 205
             }
196
-        }  elseif (409 == $code) {
206
+        } elseif (409 == $code) {
197 207
             throw new ApiError('Wrong API key');
198 208
         } else {
199 209
             throw new ApiError('Something wrong');
@@ -278,7 +288,9 @@  discard block
 block discarded – undo
278 288
         
279 289
         if ($isxml) {
280 290
             $json = $jxml;
281
-        } else $json = json_decode($result, true);
291
+        } else {
292
+        	$json = json_decode($result, true);
293
+        }
282 294
         
283 295
         if (200 == $code) {
284 296
             return $json;
@@ -319,7 +331,9 @@  discard block
 block discarded – undo
319 331
                                         echo $key1." --> "."Object <br>";
320 332
                                     } 
321 333
                                 } else {
322
-                                    if (!is_null($result1)) echo $key1." --> ".$result1."<br>";    
334
+                                    if (!is_null($result1)) {
335
+                                    	echo $key1." --> ".$result1."<br>";
336
+                                    }
323 337
                                 }
324 338
                             }
325 339
                         }
@@ -334,7 +348,9 @@  discard block
 block discarded – undo
334 348
                                 echo $key." --> "."Object <br>";
335 349
                             } 
336 350
                         } else {
337
-                            if (!is_null($result)) echo $key." --> ".$result."<br>";
351
+                            if (!is_null($result)) {
352
+                            	echo $key." --> ".$result."<br>";
353
+                            }
338 354
                         }
339 355
                         
340 356
                     }
Please login to merge, or discard this patch.
src/Route4Me/AddressBookLocation.php 1 patch
Braces   +55 added lines, -33 removed lines patch added patch discarded remove patch
@@ -149,7 +149,9 @@  discard block
 block discarded – undo
149 149
         $abLocations = new AddressBookLocation();
150 150
         
151 151
         foreach($params as $key => $value) {
152
-            if ($key == "address_id") continue; 
152
+            if ($key == "address_id") {
153
+            	continue;
154
+            }
153 155
             if (property_exists($abLocations, $key)) {
154 156
                 if (isset($params->{$key})) {
155 157
                     $body[$key] = $params->{$key};
@@ -221,44 +223,52 @@  discard block
 block discarded – undo
221 223
     {
222 224
         $schedMmodes = array("daily","weekly","monthly","annually");
223 225
         
224
-        if (in_array($scheduleMode, $schedMmodes)) 
225
-            return TRUE; 
226
-        else 
227
-            return FALSE;
226
+        if (in_array($scheduleMode, $schedMmodes)) {
227
+                    return TRUE;
228
+        } else {
229
+                    return FALSE;
230
+        }
228 231
     }
229 232
     
230 233
     public static function validateScheduleEnable($scheduleEnabled)
231 234
     {
232 235
         $schedEnambles = array(TRUE,FALSE);
233 236
         
234
-        if (in_array($scheduleEnabled, $schedEnambles))
235
-            return TRUE;
236
-        else
237
-            return FALSE;
237
+        if (in_array($scheduleEnabled, $schedEnambles)) {
238
+                    return TRUE;
239
+        } else {
240
+                    return FALSE;
241
+        }
238 242
     }
239 243
     
240 244
     public static function validateScheduleEvery($scheduleEvery)
241 245
     {
242
-        if (is_numeric($scheduleEvery))
243
-            return TRUE;
244
-        else
245
-            return FALSE;
246
+        if (is_numeric($scheduleEvery)) {
247
+                    return TRUE;
248
+        } else {
249
+                    return FALSE;
250
+        }
246 251
     }
247 252
     
248 253
     public static function validateScheduleWeekDays($scheduleWeekDays)
249 254
     {
250 255
         $weekdays = explode(',', $scheduleWeekDays);
251 256
         
252
-        if (sizeof($weekdays) < 1) return FALSE;
257
+        if (sizeof($weekdays) < 1) {
258
+        	return FALSE;
259
+        }
253 260
         
254 261
         $isValid = TRUE;
255 262
         
256 263
         for ($i=0; $i < sizeof($weekdays); $i++) { 
257 264
             if (is_numeric($weekdays[$i])) {
258 265
                 $wday = intval($weekdays[$i]);
259
-                if ($wday < 1 || $wday > 7) $isValid = FALSE;
266
+                if ($wday < 1 || $wday > 7) {
267
+                	$isValid = FALSE;
268
+                }
269
+            } else {
270
+            	$isValid = FALSE;
260 271
             }
261
-            else $isValid = FALSE;
262 272
         }
263 273
         
264 274
         return $isValid;
@@ -268,26 +278,32 @@  discard block
 block discarded – undo
268 278
     {
269 279
         $schedMonthlyMmodes = array("dates","nth");
270 280
         
271
-        if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes))
272
-            return TRUE;
273
-        else
274
-            return FALSE;
281
+        if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) {
282
+                    return TRUE;
283
+        } else {
284
+                    return FALSE;
285
+        }
275 286
     }
276 287
     
277 288
     public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
278 289
     {
279 290
         $monthlyDates = explode(',', $scheduleMonthlyDates);
280 291
         
281
-        if (sizeof($monthlyDates) <1) return FALSE;
292
+        if (sizeof($monthlyDates) <1) {
293
+        	return FALSE;
294
+        }
282 295
         
283 296
         $isValid = TRUE;
284 297
         
285 298
         for ($i=0; $i < sizeof($monthlyDates); $i++) { 
286 299
             if (is_numeric($monthlyDates[$i])) {
287 300
                 $mday = intval($monthlyDates[$i]);
288
-                if ($mday <1 || $mday > 31) $isValid = FALSE;
301
+                if ($mday <1 || $mday > 31) {
302
+                	$isValid = FALSE;
303
+                }
304
+            } else {
305
+            	$isValid = FALSE;
289 306
             }
290
-            else $isValid = FALSE;
291 307
         }
292 308
 
293 309
         return $isValid;
@@ -295,26 +311,32 @@  discard block
 block discarded – undo
295 311
     
296 312
     public static function validateScheduleNthN($scheduleNthN)
297 313
     {
298
-        if (!is_numeric($scheduleNthN)) return FALSE;
314
+        if (!is_numeric($scheduleNthN)) {
315
+        	return FALSE;
316
+        }
299 317
         
300 318
         $schedNthNs = array(1,2,3,4,5,-1);
301 319
         
302
-        if (in_array($scheduleNthN, $schedNthNs))
303
-            return TRUE;
304
-        else
305
-            return FALSE;
320
+        if (in_array($scheduleNthN, $schedNthNs)) {
321
+                    return TRUE;
322
+        } else {
323
+                    return FALSE;
324
+        }
306 325
     }
307 326
     
308 327
     public static function validateScheduleNthWhat($scheduleNthWhat)
309 328
     {
310
-        if (!is_numeric($scheduleNthWhat)) return FALSE;
329
+        if (!is_numeric($scheduleNthWhat)) {
330
+        	return FALSE;
331
+        }
311 332
         
312 333
         $schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
313 334
         
314
-        if (in_array($scheduleNthWhat, $schedNthWhats))
315
-            return TRUE;
316
-        else
317
-            return FALSE;
335
+        if (in_array($scheduleNthWhat, $schedNthWhats)) {
336
+                    return TRUE;
337
+        } else {
338
+                    return FALSE;
339
+        }
318 340
     }
319 341
     
320 342
     /* Function adds the locations (with/without schedule) from the CSV file. 
Please login to merge, or discard this patch.
src/Route4Me/curl_http_client.php 1 patch
Braces   +13 added lines, -7 removed lines patch added patch discarded remove patch
@@ -280,7 +280,10 @@  discard block
 block discarded – undo
280 280
         // set multipart form data - file array field-value pairs
281 281
         if(!empty($file_field_array)) {
282 282
             foreach($file_field_array as $var_name => $var_value) {
283
-                if(strpos(PHP_OS, "WIN") !== false) $var_value = str_replace("/", "\\", $var_value); // win hack
283
+                if(strpos(PHP_OS, "WIN") !== false) {
284
+                	$var_value = str_replace("/", "\\", $var_value);
285
+                }
286
+                // win hack
284 287
                 $file_field_array[$var_name] = "@".$var_value;
285 288
             }
286 289
         }
@@ -413,14 +416,17 @@  discard block
 block discarded – undo
413 416
         }
414 417
         
415 418
         $last_url = parse_url(curl_getinfo($ch, CURLINFO_EFFECTIVE_URL));
416
-        if (empty($url['scheme']))
417
-            $url['scheme'] = $last_url['scheme'];
419
+        if (empty($url['scheme'])) {
420
+                    $url['scheme'] = $last_url['scheme'];
421
+        }
418 422
         
419
-        if (empty($url['host']))
420
-            $url['host'] = $last_url['host'];
423
+        if (empty($url['host'])) {
424
+                    $url['host'] = $last_url['host'];
425
+        }
421 426
         
422
-        if (empty($url['path']))
423
-            $url['path'] = $last_url['path'];
427
+        if (empty($url['path'])) {
428
+                    $url['path'] = $last_url['path'];
429
+        }
424 430
         
425 431
         $new_url = $url['scheme'] . '://' . $url['host'] . $url['path'] . (!empty($url['query'])?'?'.$url['query']:'');
426 432
         //echo "Being redirected to $new_url\n";
Please login to merge, or discard this patch.
src/Route4Me/Vehicle.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -98,9 +98,15 @@  discard block
 block discarded – undo
98 98
         
99 99
         $vehicles = $this->getVehicles($query);
100 100
 
101
-        if (is_null($vehicles)) return null;
102
-        if (!isset($vehicles['data'])) return null;
103
-        if (sizeof($vehicles['data'])<1) return null;
101
+        if (is_null($vehicles)) {
102
+        	return null;
103
+        }
104
+        if (!isset($vehicles['data'])) {
105
+        	return null;
106
+        }
107
+        if (sizeof($vehicles['data'])<1) {
108
+        	return null;
109
+        }
104 110
         
105 111
         $randomIndex = rand(0, sizeof($vehicles['data'])-1);
106 112
         
@@ -126,7 +132,9 @@  discard block
 block discarded – undo
126 132
         $vehicle= new Vehicle();
127 133
         
128 134
         foreach($params as $key => $value) {
129
-            if ($key=="vehicle_id") continue; 
135
+            if ($key=="vehicle_id") {
136
+            	continue;
137
+            }
130 138
             if (property_exists($vehicle, $key)) {
131 139
                 if (isset($params->{$key})) {
132 140
                     $body[$key] = $params->{$key};
@@ -151,7 +159,9 @@  discard block
 block discarded – undo
151 159
         $vehicle= new Vehicle();
152 160
         
153 161
         foreach($params as $key => $value) {
154
-            if ($key=="vehicle_id") continue; 
162
+            if ($key=="vehicle_id") {
163
+            	continue;
164
+            }
155 165
             if (property_exists($vehicle, $key)) {
156 166
                 if (isset($params->{$key})) {
157 167
                     $body[$key] = $params->{$key};
Please login to merge, or discard this patch.
src/Route4Me/Member.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -163,18 +163,26 @@
 block discarded – undo
163 163
     {
164 164
         $members = self::getUsers();
165 165
         
166
-        if (is_null($members)) return null;
167
-        if (!isset($members['results'])) return null;
166
+        if (is_null($members)) {
167
+        	return null;
168
+        }
169
+        if (!isset($members['results'])) {
170
+        	return null;
171
+        }
168 172
         
169 173
         $memberIDs = array();
170 174
         
171 175
         foreach ($members['results'] as $memb) {
172 176
             if (isset($memb['member_id']) && isset($memb['member_type'])) {
173
-                if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id'];
177
+                if ($memberType==$memb['member_type']) {
178
+                	$memberIDs[]=$memb['member_id'];
179
+                }
174 180
             }
175 181
         }
176 182
         
177
-        if (sizeof($memberIDs)<1) return null;
183
+        if (sizeof($memberIDs)<1) {
184
+        	return null;
185
+        }
178 186
         
179 187
         $randomIndex = rand(0, sizeof($memberIDs)-1);
180 188
         
Please login to merge, or discard this patch.