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
src/Route4Me/AddressBookLocation.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -143,6 +143,9 @@
 block discarded – undo
143 143
         return null;
144 144
     }
145 145
     
146
+    /**
147
+     * @param AddressBookLocation $params
148
+     */
146 149
     public static function addAdressBookLocation($params)
147 150
     {
148 151
         $body = array();
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     {
54 54
         $addressbooklocation = new AddressBookLocation();
55 55
         
56
-        foreach($params as $key => $value) {
56
+        foreach ($params as $key => $value) {
57 57
             if (property_exists($addressbooklocation, $key)) {
58 58
                 $addressbooklocation->{$key} = $value;
59 59
             }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     
79 79
     public static function searchRoutedLocation($params)
80 80
     {
81
-        $result= Route4Me::makeRequst(array(
81
+        $result = Route4Me::makeRequst(array(
82 82
             'url'    => Endpoint::ADDRESS_BOOK_V4,
83 83
             'method' => 'GET',
84 84
             'query'  => array(
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         if (isset($ablocations["results"])) {
135 135
             $locationsSize = sizeof($ablocations["results"]);
136 136
             
137
-            if ($locationsSize > 0) {
137
+            if ($locationsSize>0) {
138 138
                 $randomLocationIndex = rand(0, $locationsSize - 1);
139 139
                 return $ablocations["results"][$randomLocationIndex];
140 140
             } 
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
         $body = array();
149 149
         $abLocations = new AddressBookLocation();
150 150
         
151
-        foreach($params as $key => $value) {
152
-            if ($key == "address_id") continue; 
151
+        foreach ($params as $key => $value) {
152
+            if ($key=="address_id") continue; 
153 153
             if (property_exists($abLocations, $key)) {
154 154
                 if (isset($params->{$key})) {
155 155
                     $body[$key] = $params->{$key};
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         $body = array();
185 185
         $abLocations = new AddressBookLocation();
186 186
         
187
-        foreach($params as $key => $value) {
187
+        foreach ($params as $key => $value) {
188 188
             if (property_exists($abLocations, $key)) {
189 189
                 if (isset($params->{$key})) {
190 190
                     $body[$key] = $params->{$key};
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     
220 220
     public static function validateScheduleMode($scheduleMode)
221 221
     {
222
-        $schedMmodes = array("daily","weekly","monthly","annually");
222
+        $schedMmodes = array("daily", "weekly", "monthly", "annually");
223 223
         
224 224
         if (in_array($scheduleMode, $schedMmodes)) 
225 225
             return TRUE; 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     
230 230
     public static function validateScheduleEnable($scheduleEnabled)
231 231
     {
232
-        $schedEnambles = array(TRUE,FALSE);
232
+        $schedEnambles = array(TRUE, FALSE);
233 233
         
234 234
         if (in_array($scheduleEnabled, $schedEnambles))
235 235
             return TRUE;
@@ -249,14 +249,14 @@  discard block
 block discarded – undo
249 249
     {
250 250
         $weekdays = explode(',', $scheduleWeekDays);
251 251
         
252
-        if (sizeof($weekdays) < 1) return FALSE;
252
+        if (sizeof($weekdays)<1) return FALSE;
253 253
         
254 254
         $isValid = TRUE;
255 255
         
256
-        for ($i=0; $i < sizeof($weekdays); $i++) { 
256
+        for ($i = 0; $i<sizeof($weekdays); $i++) { 
257 257
             if (is_numeric($weekdays[$i])) {
258 258
                 $wday = intval($weekdays[$i]);
259
-                if ($wday < 1 || $wday > 7) $isValid = FALSE;
259
+                if ($wday<1 || $wday>7) $isValid = FALSE;
260 260
             }
261 261
             else $isValid = FALSE;
262 262
         }
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
     
267 267
     public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
268 268
     {
269
-        $schedMonthlyMmodes = array("dates","nth");
269
+        $schedMonthlyMmodes = array("dates", "nth");
270 270
         
271 271
         if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes))
272 272
             return TRUE;
@@ -278,14 +278,14 @@  discard block
 block discarded – undo
278 278
     {
279 279
         $monthlyDates = explode(',', $scheduleMonthlyDates);
280 280
         
281
-        if (sizeof($monthlyDates) <1) return FALSE;
281
+        if (sizeof($monthlyDates)<1) return FALSE;
282 282
         
283 283
         $isValid = TRUE;
284 284
         
285
-        for ($i=0; $i < sizeof($monthlyDates); $i++) { 
285
+        for ($i = 0; $i<sizeof($monthlyDates); $i++) { 
286 286
             if (is_numeric($monthlyDates[$i])) {
287 287
                 $mday = intval($monthlyDates[$i]);
288
-                if ($mday <1 || $mday > 31) $isValid = FALSE;
288
+                if ($mday<1 || $mday>31) $isValid = FALSE;
289 289
             }
290 290
             else $isValid = FALSE;
291 291
         }
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     {
298 298
         if (!is_numeric($scheduleNthN)) return FALSE;
299 299
         
300
-        $schedNthNs = array(1,2,3,4,5,-1);
300
+        $schedNthNs = array(1, 2, 3, 4, 5, -1);
301 301
         
302 302
         if (in_array($scheduleNthN, $schedNthNs))
303 303
             return TRUE;
@@ -333,17 +333,17 @@  discard block
 block discarded – undo
333 333
         $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
334 334
 
335 335
         if (empty($columns)) {
336
-            array_push($results['fail'],'Empty CSV table');
336
+            array_push($results['fail'], 'Empty CSV table');
337 337
             return ($results);
338 338
         }
339 339
 
340 340
         $iRow = 1;
341 341
         
342
-        while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr)) !== false) {
342
+        while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) {
343 343
             if ($rows[$locationsFieldsMapping['cached_lat']] 
344 344
                   && $rows[$locationsFieldsMapping['cached_lng']] 
345 345
                   && $rows[$locationsFieldsMapping['address_1']] 
346
-                  && array(null) !== $rows) {
346
+                  && array(null)!==$rows) {
347 347
                 $curSchedule = "";
348 348
                 $mode = "";
349 349
                 
@@ -352,32 +352,32 @@  discard block
 block discarded – undo
352 352
                         $curSchedule = '"mode":"'.$rows[$locationsFieldsMapping['schedule_mode']].'",'; 
353 353
                         $mode = $rows[$locationsFieldsMapping['schedule_mode']];
354 354
                     } else {
355
-                        array_push($results['fail'],"$iRow --> Wrong schedule mode parameter"); 
355
+                        array_push($results['fail'], "$iRow --> Wrong schedule mode parameter"); 
356 356
                         $curSchedule = "";
357 357
                     }
358 358
                 } else {
359
-                    array_push($results['fail'],"$iRow --> The schedule mode parameter is not set"); 
359
+                    array_push($results['fail'], "$iRow --> The schedule mode parameter is not set"); 
360 360
                     $curSchedule = "";
361 361
                 }
362 362
                 
363 363
                 if (isset($rows[$locationsFieldsMapping['schedule_enabled']])) {
364 364
                     if ($this->validateScheduleEnable($rows[$locationsFieldsMapping['schedule_enabled']])) { 
365
-                        $curSchedule.='"enabled":'.$rows[$locationsFieldsMapping['schedule_enabled']].',';
365
+                        $curSchedule .= '"enabled":'.$rows[$locationsFieldsMapping['schedule_enabled']].',';
366 366
                     } else {
367
-                        array_push($results['fail'],"$iRow --> The schedule enabled parameter is not set ");  
367
+                        array_push($results['fail'], "$iRow --> The schedule enabled parameter is not set ");  
368 368
                         $curSchedule = "";
369 369
                     }
370 370
                 }
371 371
                 
372 372
                 if (isset($rows[$locationsFieldsMapping['schedule_every']])) {
373 373
                     if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) {
374
-                        $curSchedule.='"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; 
375
-                        if ($mode == 'daily') {
376
-                            $curSchedule = trim($curSchedule,',');
377
-                            $curSchedule.='}';
374
+                        $curSchedule .= '"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; 
375
+                        if ($mode=='daily') {
376
+                            $curSchedule = trim($curSchedule, ',');
377
+                            $curSchedule .= '}';
378 378
                         }
379 379
                     } else {
380
-                        array_push($results['fail'],"$iRow --> The parameter sched_every is not set"); 
380
+                        array_push($results['fail'], "$iRow --> The parameter sched_every is not set"); 
381 381
                         $curSchedule = ""; 
382 382
                     }
383 383
                 }
@@ -387,13 +387,13 @@  discard block
 block discarded – undo
387 387
                         case 'weekly':
388 388
                             if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
389 389
                                 if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
390
-                                     $curSchedule.='"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
390
+                                     $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
391 391
                                 } else {
392
-                                    array_push($results['fail'],"$iRow --> Wrong weekdays"); 
392
+                                    array_push($results['fail'], "$iRow --> Wrong weekdays"); 
393 393
                                     $curSchedule = "";
394 394
                                 }
395 395
                             } else {
396
-                                array_push($results['fail'],"$iRow --> The parameters sched_weekdays is not set"); 
396
+                                array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); 
397 397
                                 $curSchedule = "";
398 398
                             }
399 399
                             break;
@@ -402,24 +402,24 @@  discard block
 block discarded – undo
402 402
                             if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
403 403
                                 if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
404 404
                                      $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
405
-                                     $curSchedule.='"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
405
+                                     $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
406 406
                                 } else {
407
-                                    array_push($results['fail'],"$iRow --> Wrong monthly mode"); 
407
+                                    array_push($results['fail'], "$iRow --> Wrong monthly mode"); 
408 408
                                     $curSchedule = "";
409 409
                                 }
410 410
                             } else {
411
-                                array_push($results['fail'],"$iRow --> The parameter sched_monthly_mode is not set"); 
411
+                                array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); 
412 412
                                 $curSchedule = "";
413 413
                             }
414 414
                             
415
-                            if ($monthlyMode != "") {
415
+                            if ($monthlyMode!="") {
416 416
                                 switch ($monthlyMode) {
417 417
                                     case 'dates':
418 418
                                         if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
419 419
                                             if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
420
-                                                 $curSchedule.='"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
420
+                                                 $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
421 421
                                             } else {
422
-                                                array_push($results['fail'],"$iRow --> Wrong monthly dates"); 
422
+                                                array_push($results['fail'], "$iRow --> Wrong monthly dates"); 
423 423
                                                 $curSchedule = "";
424 424
                                             }
425 425
                                         }
@@ -427,26 +427,26 @@  discard block
 block discarded – undo
427 427
                                     case 'nth':
428 428
                                         if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
429 429
                                             if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
430
-                                                 $curSchedule.='"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
430
+                                                 $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
431 431
                                             } else {
432
-                                                array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_n"); 
432
+                                                array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); 
433 433
                                                 $curSchedule = "";
434 434
                                             }
435 435
                                         } else {
436
-                                            array_push($results['fail'],"$iRow --> The parameter sched_nth_n is not set"); 
436
+                                            array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); 
437 437
                                             $curSchedule = "";
438 438
                                         }
439 439
                                         
440
-                                        if ($curSchedule != "") {
440
+                                        if ($curSchedule!="") {
441 441
                                             if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
442 442
                                                 if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
443
-                                                     $curSchedule.='"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}';
443
+                                                     $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}';
444 444
                                                 } else {
445
-                                                    array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_what"); 
445
+                                                    array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); 
446 446
                                                     $curSchedule = "";
447 447
                                                 }
448 448
                                             } else {
449
-                                                array_push($results['fail'],"$iRow --> The parameter sched_nth_what is not set"); 
449
+                                                array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); 
450 450
                                                 $curSchedule = "";
451 451
                                             }
452 452
                                         }
@@ -460,16 +460,16 @@  discard block
 block discarded – undo
460 460
                     }
461 461
                 }
462 462
 
463
-                if (($mode == 'daily' || $mode == 'weekly' || $mode == 'monthy') && $curSchedule == "") {
463
+                if (($mode=='daily' || $mode=='weekly' || $mode=='monthy') && $curSchedule=="") {
464 464
                     $iRow++; 
465 465
                     continue;
466 466
                 }
467 467
                 
468
-                $curSchedule =strtolower($curSchedule);
468
+                $curSchedule = strtolower($curSchedule);
469 469
                 
470 470
                 $curSchedule = '[{'.$curSchedule.'}]';
471 471
 
472
-                $oSchedule = json_decode($curSchedule,TRUE);
472
+                $oSchedule = json_decode($curSchedule, TRUE);
473 473
                 
474 474
                 $AdressBookLocationParameters = AddressBookLocation::fromArray(array(
475 475
                     "cached_lat"                 => $rows[$locationsFieldsMapping['cached_lat']],
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 
545 545
                 $abcResults = $abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
546 546
                 
547
-                array_push($results['success'],"The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly.");
547
+                array_push($results['success'], "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly.");
548 548
             }
549 549
         }
550 550
 
Please login to merge, or discard this patch.
src/Route4Me/Order.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -71,6 +71,9 @@
 block discarded – undo
71 71
         return $order;
72 72
     }
73 73
     
74
+    /**
75
+     * @param Order $params
76
+     */
74 77
     public static function addOrder($params)
75 78
     {
76 79
         $response = Route4Me::makeRequst(array(
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
     public $custom_user_fields;
62 62
     
63 63
     public static function fromArray(array $params) {
64
-        $order= new Order();
65
-        foreach($params as $key => $value) {
64
+        $order = new Order();
65
+        foreach ($params as $key => $value) {
66 66
             if (property_exists($order, $key)) {
67 67
                 $order->{$key} = $value;
68 68
             }
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
             'url'    => Endpoint::ORDER_V4,
78 78
             'method' => 'POST',
79 79
             'body'   => array(
80
-                'address_1'                 =>  isset($params->address_1) ? $params->address_1: null,
81
-                'address_2'                 =>  isset($params->address_2) ? $params->address_2: null,
82
-                'member_id'                 =>  isset($params->member_id) ? $params->member_id: null,
80
+                'address_1'                 =>  isset($params->address_1) ? $params->address_1 : null,
81
+                'address_2'                 =>  isset($params->address_2) ? $params->address_2 : null,
82
+                'member_id'                 =>  isset($params->member_id) ? $params->member_id : null,
83 83
                 'cached_lat'                =>  isset($params->cached_lat) ? $params->cached_lat : null,
84 84
                 'cached_lng'                =>  isset($params->cached_lng) ? $params->cached_lng : null,
85 85
                 'curbside_lat'              =>  isset($params->curbside_lat) ? $params->curbside_lat : null,
@@ -88,40 +88,40 @@  discard block
 block discarded – undo
88 88
                 'order_icon'                =>  isset($params->order_icon) ? $params->order_icon : null,
89 89
                 'day_scheduled_for_YYMMDD'  =>  isset($params->day_scheduled_for_YYMMDD) ? $params->day_scheduled_for_YYMMDD : null,
90 90
                 'address_alias'             =>  isset($params->address_alias) ? $params->address_alias : null,
91
-                'address_city'              =>  isset($params->address_city) ? $params->address_city: null,
92
-                'address_state_id'          =>  isset($params->address_state_id) ? $params->address_state_id: null,
93
-                'address_country_id'        =>  isset($params->address_country_id) ? $params->address_country_id: null,
94
-                'address_zip'               =>  isset($params->address_zip) ? $params->address_zip: null,
95
-                'local_time_window_start'   =>  isset($params->local_time_window_start) ? $params->local_time_window_start: null,
96
-                'local_time_window_end'     =>  isset($params->local_time_window_end) ? $params->local_time_window_end: null,
97
-                'local_time_window_start_2' =>  isset($params->local_time_window_start_2) ? $params->local_time_window_start_2: null,
98
-                'local_time_window_end_2'   =>  isset($params->local_time_window_end_2) ? $params->local_time_window_end_2: null,
99
-                'service_time'              =>  isset($params->service_time) ? $params->service_time: null,
100
-                'local_timezone_string'     =>  isset($params->local_timezone_string) ? $params->local_timezone_string: null,
101
-                'EXT_FIELD_first_name'      =>  isset($params->EXT_FIELD_first_name) ? $params->EXT_FIELD_first_name: null,
102
-                'EXT_FIELD_last_name'       =>  isset($params->EXT_FIELD_last_name) ? $params->EXT_FIELD_last_name: null,
103
-                'EXT_FIELD_email'           =>  isset($params->EXT_FIELD_email) ? $params->EXT_FIELD_email: null,
104
-                'EXT_FIELD_phone'           =>  isset($params->EXT_FIELD_phone) ? $params->EXT_FIELD_phone: null,
105
-                'EXT_FIELD_custom_data'     =>  isset($params->EXT_FIELD_custom_data) ? $params->EXT_FIELD_custom_data: null,
106
-                'is_validated'              =>  isset($params->is_validated) ? $params->is_validated: null,
107
-                'is_pending'                =>  isset($params->is_pending) ? $params->is_pending: null,
108
-                'is_accepted'               =>  isset($params->is_accepted) ? $params->is_accepted: null,
109
-                'is_started'                =>  isset($params->is_started) ? $params->is_started: null,
110
-                'is_completed'              =>  isset($params->is_completed) ? $params->is_completed: null,
111
-                'custom_user_fields'        =>  isset($params->custom_user_fields) ? $params->custom_user_fields: null
91
+                'address_city'              =>  isset($params->address_city) ? $params->address_city : null,
92
+                'address_state_id'          =>  isset($params->address_state_id) ? $params->address_state_id : null,
93
+                'address_country_id'        =>  isset($params->address_country_id) ? $params->address_country_id : null,
94
+                'address_zip'               =>  isset($params->address_zip) ? $params->address_zip : null,
95
+                'local_time_window_start'   =>  isset($params->local_time_window_start) ? $params->local_time_window_start : null,
96
+                'local_time_window_end'     =>  isset($params->local_time_window_end) ? $params->local_time_window_end : null,
97
+                'local_time_window_start_2' =>  isset($params->local_time_window_start_2) ? $params->local_time_window_start_2 : null,
98
+                'local_time_window_end_2'   =>  isset($params->local_time_window_end_2) ? $params->local_time_window_end_2 : null,
99
+                'service_time'              =>  isset($params->service_time) ? $params->service_time : null,
100
+                'local_timezone_string'     =>  isset($params->local_timezone_string) ? $params->local_timezone_string : null,
101
+                'EXT_FIELD_first_name'      =>  isset($params->EXT_FIELD_first_name) ? $params->EXT_FIELD_first_name : null,
102
+                'EXT_FIELD_last_name'       =>  isset($params->EXT_FIELD_last_name) ? $params->EXT_FIELD_last_name : null,
103
+                'EXT_FIELD_email'           =>  isset($params->EXT_FIELD_email) ? $params->EXT_FIELD_email : null,
104
+                'EXT_FIELD_phone'           =>  isset($params->EXT_FIELD_phone) ? $params->EXT_FIELD_phone : null,
105
+                'EXT_FIELD_custom_data'     =>  isset($params->EXT_FIELD_custom_data) ? $params->EXT_FIELD_custom_data : null,
106
+                'is_validated'              =>  isset($params->is_validated) ? $params->is_validated : null,
107
+                'is_pending'                =>  isset($params->is_pending) ? $params->is_pending : null,
108
+                'is_accepted'               =>  isset($params->is_accepted) ? $params->is_accepted : null,
109
+                'is_started'                =>  isset($params->is_started) ? $params->is_started : null,
110
+                'is_completed'              =>  isset($params->is_completed) ? $params->is_completed : null,
111
+                'custom_user_fields'        =>  isset($params->custom_user_fields) ? $params->custom_user_fields : null
112 112
             )
113 113
         ));
114 114
 
115 115
         return $response;
116 116
     }
117 117
 
118
-    public static function addOrder2Route($params,$body)
118
+    public static function addOrder2Route($params, $body)
119 119
     {
120 120
         $response = Route4Me::makeRequst(array(
121 121
             'url'    => Endpoint::ROUTE_V4,
122 122
             'method' => 'PUT',
123 123
             'query'  => array(
124
-                'route_id' => isset($params->route_id) ? $params->route_id: null,
124
+                'route_id' => isset($params->route_id) ? $params->route_id : null,
125 125
                 'redirect' => isset($params->redirect) ? $params->redirect : null
126 126
             ),
127 127
             'body' => (array)$body
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         return $response;
131 131
     }
132 132
     
133
-    public static function addOrder2Optimization($params,$body)
133
+    public static function addOrder2Optimization($params, $body)
134 134
     {
135 135
         $response = Route4Me::makeRequst(array(
136 136
             'url'    => Endpoint::OPTIMIZATION_PROBLEM,
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
             'url'    => Endpoint::ORDER_V4,
153 153
             'method' => 'GET',
154 154
             'query'  => array(
155
-                'order_id'             => isset($params->order_id) ? $params->order_id: null,
156
-                'fields'               => isset($params->fields) ? $params->fields: null,
157
-                'day_added_YYMMDD'     => isset($params->day_added_YYMMDD) ? $params->day_added_YYMMDD: null,
158
-                'scheduled_for_YYMMDD' => isset($params->scheduled_for_YYMMDD) ? $params->scheduled_for_YYMMDD: null,
159
-                'query'                => isset($params->query) ? $params->query: null,
160
-                'offset'               => isset($params->offset) ? $params->offset: null,
161
-                'limit'                => isset($params->limit) ? $params->limit: null
155
+                'order_id'             => isset($params->order_id) ? $params->order_id : null,
156
+                'fields'               => isset($params->fields) ? $params->fields : null,
157
+                'day_added_YYMMDD'     => isset($params->day_added_YYMMDD) ? $params->day_added_YYMMDD : null,
158
+                'scheduled_for_YYMMDD' => isset($params->scheduled_for_YYMMDD) ? $params->scheduled_for_YYMMDD : null,
159
+                'query'                => isset($params->query) ? $params->query : null,
160
+                'offset'               => isset($params->offset) ? $params->offset : null,
161
+                'limit'                => isset($params->limit) ? $params->limit : null
162 162
             )
163 163
         ));
164 164
 
@@ -171,15 +171,15 @@  discard block
 block discarded – undo
171 171
             'url'    => Endpoint::ORDER_V4,
172 172
             'method' => 'GET',
173 173
             'query'  => array(
174
-                'offset' => isset($params->offset) ? $params->offset: null,
175
-                'limit'  => isset($params->limit) ? $params->limit: null
174
+                'offset' => isset($params->offset) ? $params->offset : null,
175
+                'limit'  => isset($params->limit) ? $params->limit : null
176 176
             )
177 177
         ));
178 178
 
179 179
         return $response;
180 180
     }
181 181
     
182
-    public function getRandomOrderId($offset,$limit)
182
+    public function getRandomOrderId($offset, $limit)
183 183
     {
184 184
         $params = array('offset' => $offset, 'limit' => $limit);
185 185
         
@@ -188,14 +188,14 @@  discard block
 block discarded – undo
188 188
         if (is_null($orders)) return null;
189 189
         if (!isset($orders['results'])) return null;
190 190
         
191
-        $randomIndex = rand(0, sizeof($orders['results'])-1);
191
+        $randomIndex = rand(0, sizeof($orders['results']) - 1);
192 192
         
193 193
         $order = $orders['results'][$randomIndex];
194 194
         
195 195
         return $order['order_id'];
196 196
     }
197 197
     
198
-    public function getRandomOrder($offset,$limit)
198
+    public function getRandomOrder($offset, $limit)
199 199
     {
200 200
         $params = array('offset' => $offset, 'limit' => $limit);
201 201
         
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         if (is_null($orders)) return null;
205 205
         if (!isset($orders['results'])) return null;
206 206
         
207
-        $randomIndex = rand(0, sizeof($orders['results'])-1);
207
+        $randomIndex = rand(0, sizeof($orders['results']) - 1);
208 208
         
209 209
         $order = $orders['results'][$randomIndex];
210 210
         
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             'url'    => Endpoint::ORDER_V4,
218 218
             'method' => 'DELETE',
219 219
             'body'   => array(
220
-                'order_ids' =>  isset($params->order_ids) ? $params->order_ids: null
220
+                'order_ids' =>  isset($params->order_ids) ? $params->order_ids : null
221 221
             )
222 222
         ));
223 223
 
@@ -241,12 +241,12 @@  discard block
 block discarded – undo
241 241
             'url'    => Endpoint::ORDER_V4,
242 242
             'method' => 'GET',
243 243
             'query'  => array(
244
-                'day_added_YYMMDD'     =>  isset($params->day_added_YYMMDD) ? $params->day_added_YYMMDD: null,
245
-                'scheduled_for_YYMMDD' =>  isset($params->scheduled_for_YYMMDD) ? $params->scheduled_for_YYMMDD: null,
246
-                'fields'               =>  isset($params->fields) ? $params->fields: null,
247
-                'offset'               =>  isset($params->offset) ? $params->offset: null,
248
-                'limit'                =>  isset($params->limit) ? $params->limit: null,
249
-                'query'                =>  isset($params->query) ? $params->query: null,
244
+                'day_added_YYMMDD'     =>  isset($params->day_added_YYMMDD) ? $params->day_added_YYMMDD : null,
245
+                'scheduled_for_YYMMDD' =>  isset($params->scheduled_for_YYMMDD) ? $params->scheduled_for_YYMMDD : null,
246
+                'fields'               =>  isset($params->fields) ? $params->fields : null,
247
+                'offset'               =>  isset($params->offset) ? $params->offset : null,
248
+                'limit'                =>  isset($params->limit) ? $params->limit : null,
249
+                'query'                =>  isset($params->query) ? $params->query : null,
250 250
             )
251 251
         ));
252 252
 
@@ -283,19 +283,19 @@  discard block
 block discarded – undo
283 283
         $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
284 284
         
285 285
         if (!empty($columns)) {
286
-             array_push($results['fail'],'Empty CSV table');
286
+             array_push($results['fail'], 'Empty CSV table');
287 287
              return ($results);
288 288
         }
289 289
                  
290
-        $iRow=1;
290
+        $iRow = 1;
291 291
         
292
-        while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr)) !== false) {
293
-            if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && array(null) !== $rows) {
292
+        while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) {
293
+            if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && array(null)!==$rows) {
294 294
                 
295 295
                 $cached_lat = 0.000;
296 296
                 
297 297
                 if (!$this->validateLatitude($rows[$ordersFieldsMapping['cached_lat']])) {
298
-                    array_push($results['fail'],"$iRow --> Wrong cached_lat"); 
298
+                    array_push($results['fail'], "$iRow --> Wrong cached_lat"); 
299 299
                     $iRow++;
300 300
                     continue;
301 301
                 }
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
                 $cached_lng = 0.000;
305 305
                 
306 306
                 if (!$this->validateLongitude($rows[$ordersFieldsMapping['cached_lng']])) {
307
-                    array_push($results['fail'],"$iRow --> Wrong cached_lng"); 
307
+                    array_push($results['fail'], "$iRow --> Wrong cached_lng"); 
308 308
                     $iRow++;
309 309
                     continue;
310 310
                 }
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
                 
313 313
                 if (isset($ordersFieldsMapping['curbside_lat'])) {
314 314
                     if (!$this->validateLatitude($rows[$ordersFieldsMapping['curbside_lat']])) {
315
-                        array_push($results['fail'],"$iRow --> Wrong curbside_lat"); 
315
+                        array_push($results['fail'], "$iRow --> Wrong curbside_lat"); 
316 316
                         $iRow++;
317 317
                         continue;
318 318
                     }
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
                 
321 321
                 if (isset($ordersFieldsMapping['curbside_lng'])) {
322 322
                     if (!$this->validateLongitude($rows[$ordersFieldsMapping['curbside_lng']])) {
323
-                        array_push($results['fail'],"$iRow --> Wrong curbside_lng"); 
323
+                        array_push($results['fail'], "$iRow --> Wrong curbside_lng"); 
324 324
                         $iRow++;
325 325
                         continue;
326 326
                     }
@@ -328,10 +328,10 @@  discard block
 block discarded – undo
328 328
                 
329 329
                 $address = $rows[$ordersFieldsMapping['address_1']];
330 330
                 
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']];
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']];
335 335
                 
336 336
                 echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].", ".$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']]."<br>";
337 337
                 
@@ -373,10 +373,10 @@  discard block
 block discarded – undo
373 373
                 
374 374
                 $orderResults = $order->addOrder($orderParameters);
375 375
                 
376
-                array_push($results['success'],"The order with order_id = ".strval($orderResults["order_id"])." added successfuly.");
376
+                array_push($results['success'], "The order with order_id = ".strval($orderResults["order_id"])." added successfuly.");
377 377
             }
378 378
             else {
379
-                array_push($results['fail'],"$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); 
379
+                array_push($results['fail'], "$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); 
380 380
             }
381 381
             
382 382
             $iRow++;
Please login to merge, or discard this patch.
src/Route4Me/Route4Me.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -200,6 +200,9 @@
 block discarded – undo
200 200
         }
201 201
     }
202 202
 
203
+    /**
204
+     * @param \SimpleXMLElement $object
205
+     */
203 206
     public static function object2array($object)
204 207
     {
205 208
         return @json_decode(@json_encode($object),1);
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 
45 45
         $rpath = function_exists('curl_file_create') ? curl_file_create(realpath($fname)) : '@'.realpath($fname);
46 46
         
47
-        $url = self::$baseUrl.$options['url'] . '?' . http_build_query(array_merge(
48
-            array( 'api_key' => self::getApiKey()), $query)
47
+        $url = self::$baseUrl.$options['url'].'?'.http_build_query(array_merge(
48
+            array('api_key' => self::getApiKey()), $query)
49 49
         );
50 50
         
51 51
         $ch = curl_init($url);
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
         $json = json_decode($result, true);
79 79
         
80
-        if (200 == $code) {
80
+        if (200==$code) {
81 81
             return $json;
82 82
         } elseif (isset($json['errors'])) {
83 83
             throw new ApiError(implode(', ', $json['errors']));
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     public static function makeRequst($options) {
90 90
         $errorHandler = new myErrorHandler();
91 91
         
92
-        $old_error_handler = set_error_handler(array( $errorHandler, "proc_error"));
92
+        $old_error_handler = set_error_handler(array($errorHandler, "proc_error"));
93 93
         $method = isset($options['method']) ? $options['method'] : 'GET';
94 94
         $query = isset($options['query']) ?
95 95
             array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
@@ -101,22 +101,22 @@  discard block
 block discarded – undo
101 101
         );
102 102
         
103 103
         if (isset($options['HTTPHEADER'])) {
104
-            $headers[]=$options['HTTPHEADER'];
104
+            $headers[] = $options['HTTPHEADER'];
105 105
         }
106 106
          
107 107
         if (isset($options['HTTPHEADERS'])) {
108
-            foreach ($options['HTTPHEADERS'] As $header) $headers[]=$header;
108
+            foreach ($options['HTTPHEADERS'] As $header) $headers[] = $header;
109 109
         }
110 110
 
111 111
         $ch = curl_init();
112
-        $url = $options['url'] . '?' . http_build_query(array_merge(
113
-            $query, array( 'api_key' => self::getApiKey())
112
+        $url = $options['url'].'?'.http_build_query(array_merge(
113
+            $query, array('api_key' => self::getApiKey())
114 114
         ));
115 115
 
116
-        $baseUrl=self::getBaseUrl();
116
+        $baseUrl = self::getBaseUrl();
117 117
 
118 118
         $curlOpts = arraY(
119
-            CURLOPT_URL            => $baseUrl. $url,
119
+            CURLOPT_URL            => $baseUrl.$url,
120 120
             CURLOPT_RETURNTRANSFER => true,
121 121
             CURLOPT_TIMEOUT        => 80,
122 122
             CURLOPT_FOLLOWLOCATION => true,
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
         
128 128
         curl_setopt_array($ch, $curlOpts);
129 129
         
130
-        if ($file !=null) {
130
+        if ($file!=null) {
131 131
             curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
132
-            $fp=fopen($file,'r');
133
-            curl_setopt($ch, CURLOPT_INFILE , $fp);
132
+            $fp = fopen($file, 'r');
133
+            curl_setopt($ch, CURLOPT_INFILE, $fp);
134 134
             curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
135 135
         }
136 136
 
137
-        switch($method) {
137
+        switch ($method) {
138 138
         case 'DELETE':
139 139
             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
140 140
 
@@ -170,20 +170,20 @@  discard block
 block discarded – undo
170 170
 
171 171
         $result = curl_exec($ch);
172 172
         
173
-        $isxml=FALSE;
174
-        $jxml="";
173
+        $isxml = FALSE;
174
+        $jxml = "";
175 175
         if (strpos($result, '<?xml')>-1)
176 176
         {
177 177
             $xml = simplexml_load_string($result);
178 178
             //$jxml = json_encode($xml);
179
-            $jxml=self::object2array($xml);
179
+            $jxml = self::object2array($xml);
180 180
             $isxml = TRUE;
181 181
         }
182 182
         
183 183
         $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
184 184
         curl_close($ch);
185 185
         
186
-        if (200 == $code) {
186
+        if (200==$code) {
187 187
             if ($isxml) {
188 188
                 $json = $jxml;
189 189
             } else $json = json_decode($result, true);
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
             } else {
194 194
                 return $json;
195 195
             }
196
-        }  elseif (409 == $code) {
196
+        }  elseif (409==$code) {
197 197
             throw new ApiError('Wrong API key');
198 198
         } else {
199 199
             throw new ApiError('Something wrong');
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
     public static function object2array($object)
204 204
     {
205
-        return @json_decode(@json_encode($object),1);
205
+        return @json_decode(@json_encode($object), 1);
206 206
     }
207 207
 
208 208
     public static function makeUrlRequst($url, $options) {
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
         
227 227
         curl_setopt_array($ch, $curlOpts);
228 228
         
229
-        switch($method) {
229
+        switch ($method) {
230 230
         case 'DELETE':
231 231
             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
232 232
 
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
 
265 265
         $result = curl_exec($ch);
266 266
         
267
-        $isxml=FALSE;
268
-        $jxml="";
267
+        $isxml = FALSE;
268
+        $jxml = "";
269 269
         if (strpos($result, '<?xml')>-1)
270 270
         {
271 271
             $xml = simplexml_load_string($result);
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
             $json = $jxml;
281 281
         } else $json = json_decode($result, true);
282 282
         
283
-        if (200 == $code) {
283
+        if (200==$code) {
284 284
             return $json;
285 285
         } elseif (isset($json['errors'])) {
286 286
             throw new ApiError(implode(', ', $json['errors']));
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
      * Prints on the screen main keys and values of the array 
294 294
      *
295 295
      */
296
-    public static function simplePrint($results, $deepPrinting=null)
296
+    public static function simplePrint($results, $deepPrinting = null)
297 297
     {
298 298
         if (isset($results)) {
299 299
             if (is_array($results)) {
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
                             if (is_array($result1)) {
304 304
                                   if ($deepPrinting) {
305 305
                                       echo "<br>$key1 ------><br>";
306
-                                      Route4Me::simplePrint($result1,true);
306
+                                      Route4Me::simplePrint($result1, true);
307 307
                                       echo "------<br>";
308 308
                                   } else {
309 309
                                       echo $key1." --> "."Array() <br>";
@@ -312,8 +312,8 @@  discard block
 block discarded – undo
312 312
                                 if (is_object($result1)) {
313 313
                                     if ($deepPrinting) {
314 314
                                         echo "<br>$key1 ------><br>";
315
-                                        $oarray=(array)$result1;
316
-                                        Route4Me::simplePrint($oarray,true);
315
+                                        $oarray = (array)$result1;
316
+                                        Route4Me::simplePrint($oarray, true);
317 317
                                         echo "------<br>";
318 318
                                     } else {
319 319
                                         echo $key1." --> "."Object <br>";
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
                         if (is_object($result)) {
328 328
                             if ($deepPrinting) {
329 329
                                 echo "<br>$key ------><br>";
330
-                                $oarray=(array)$result;
331
-                                Route4Me::simplePrint($oarray,true);
330
+                                $oarray = (array)$result;
331
+                                Route4Me::simplePrint($oarray, true);
332 332
                                 echo "------<br>";
333 333
                             } else {
334 334
                                 echo $key." --> "."Object <br>";
Please login to merge, or discard this patch.
examples/Activities/SearchActivities.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Route4Me;
3 3
 
4
-$root=realpath(dirname(__FILE__).'/../../');
4
+$root = realpath(dirname(__FILE__).'/../../');
5 5
 require $root.'/vendor/autoload.php';
6 6
 
7 7
 use Route4Me\Route4Me;
Please login to merge, or discard this patch.
examples/Activities/GetActivities.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Route4Me;
3 3
 
4
-$root = realpath(dirname(__FILE__) . '/../../');
5
-require $root . '/vendor/autoload.php';
4
+$root = realpath(dirname(__FILE__).'/../../');
5
+require $root.'/vendor/autoload.php';
6 6
 
7 7
 use Route4Me\Route4Me;
8 8
 use Route4Me\Route;
Please login to merge, or discard this patch.
examples/Activities/GetRouteActivities.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Route4Me;
3 3
 
4
-$root=realpath(dirname(__FILE__).'/../../');
4
+$root = realpath(dirname(__FILE__).'/../../');
5 5
 require $root.'/vendor/autoload.php';
6 6
 
7 7
 use Route4Me\Route4Me;
Please login to merge, or discard this patch.
examples/Activities/GetLastActivities.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Route4Me;
3 3
 
4
-$root = realpath(dirname(__FILE__) . '/../../');
5
-require $root . '/vendor/autoload.php';
4
+$root = realpath(dirname(__FILE__).'/../../');
5
+require $root.'/vendor/autoload.php';
6 6
 
7 7
 use Route4Me\Route4Me;
8 8
 use Route4Me\Route;
Please login to merge, or discard this patch.
examples/Activities/SendUserMessage.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Route4Me;
3 3
 
4
-$root=realpath(dirname(__FILE__).'/../../');
4
+$root = realpath(dirname(__FILE__).'/../../');
5 5
 require $root.'/vendor/autoload.php';
6 6
 
7 7
 use Route4Me\Route4Me;
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
 
27 27
 $results = $activities->sendUserMessage($postParameters);
28 28
 
29
-$msg = isset($results["status"]) != null
29
+$msg = isset($results["status"])!=null
30 30
   ? ($results["status"]==1 ? "The user message was sent to the route " : "he user message could not sent to the route ")
31 31
    : "The user message could not sent to the route "; 
32 32
    
33
-$msg.=" with route_id=".$route_id;
33
+$msg .= " with route_id=".$route_id;
34 34
    
35 35
 echo "<br> $msg <br>";   
Please login to merge, or discard this patch.
examples/Activities/GetRouteTeamActivities.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Route4Me;
3 3
 
4
-$root = realpath(dirname(__FILE__) . '/../../');
5
-require $root . '/vendor/autoload.php';
4
+$root = realpath(dirname(__FILE__).'/../../');
5
+require $root.'/vendor/autoload.php';
6 6
 
7 7
 use Route4Me\Route4Me;
8 8
 use Route4Me\Route;
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 $activities = new ActivityParameters();
28 28
 $actresults = $activities->get($activityParameters);
29
-$results = $activities->getValue($actresults,"results");
29
+$results = $activities->getValue($actresults, "results");
30 30
 
31 31
 foreach ($results as $result) {
32 32
 	Route4Me::simplePrint($result);
Please login to merge, or discard this patch.