@@ -1,7 +1,7 @@ |
||
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; |
@@ -1,7 +1,7 @@ |
||
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; |
@@ -1,7 +1,7 @@ |
||
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; |
@@ -1,7 +1,7 @@ |
||
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; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | public static function searchOrder($params) |
217 | 217 | { |
218 | - $allQueryFields = array('fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit' ); |
|
218 | + $allQueryFields = array('fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit'); |
|
219 | 219 | |
220 | 220 | $response = Route4Me::makeRequst(array( |
221 | 221 | 'url' => Endpoint::ORDER_V4, |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | $allOrderFields = Route4Me::getObjectProperties(new Order(), $excludeFields); |
270 | 270 | |
271 | 271 | if (!empty($columns)) { |
272 | - array_push($results['fail'],'Empty CSV table'); |
|
272 | + array_push($results['fail'], 'Empty CSV table'); |
|
273 | 273 | return ($results); |
274 | 274 | } |
275 | 275 | |
276 | - $iRow=1; |
|
276 | + $iRow = 1; |
|
277 | 277 | |
278 | 278 | while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) { |
279 | 279 | if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && array(null)!==$rows) { |
@@ -19,7 +19,7 @@ |
||
19 | 19 | { |
20 | 20 | $geocoding = new Geocoding(); |
21 | 21 | |
22 | - foreach($params as $key => $value) { |
|
22 | + foreach ($params as $key => $value) { |
|
23 | 23 | if (property_exists($geocoding, $key)) { |
24 | 24 | $geocoding->{$key} = $value; |
25 | 25 | } |
@@ -171,7 +171,7 @@ |
||
171 | 171 | |
172 | 172 | public function mergeRoutes($params) |
173 | 173 | { |
174 | - $allBodyFields = array('route_ids', 'depot_address', 'remove_origin', 'depot_lat', 'depot_lng'); |
|
174 | + $allBodyFields = array('route_ids', 'depot_address', 'remove_origin', 'depot_lat', 'depot_lng'); |
|
175 | 175 | |
176 | 176 | $result = Route4Me::makeRequst(array( |
177 | 177 | 'url' => Endpoint::ROUTES_MERGE, |
@@ -351,70 +351,70 @@ |
||
351 | 351 | |
352 | 352 | if ($mode!='daily') { |
353 | 353 | switch ($mode) { |
354 | - case 'weekly': |
|
355 | - if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
356 | - if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
357 | - $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}'; |
|
358 | - } else { |
|
359 | - array_push($results['fail'], "$iRow --> Wrong weekdays"); |
|
360 | - } |
|
354 | + case 'weekly': |
|
355 | + if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
356 | + if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
357 | + $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}'; |
|
361 | 358 | } else { |
362 | - array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); |
|
359 | + array_push($results['fail'], "$iRow --> Wrong weekdays"); |
|
363 | 360 | } |
364 | - break; |
|
365 | - case 'monthly': |
|
366 | - $monthlyMode = ""; |
|
367 | - if (isset($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
368 | - if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
369 | - $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']]; |
|
370 | - $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",'; |
|
371 | - } else { |
|
372 | - array_push($results['fail'], "$iRow --> Wrong monthly mode"); |
|
373 | - } |
|
361 | + } else { |
|
362 | + array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); |
|
363 | + } |
|
364 | + break; |
|
365 | + case 'monthly': |
|
366 | + $monthlyMode = ""; |
|
367 | + if (isset($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
368 | + if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
369 | + $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']]; |
|
370 | + $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",'; |
|
374 | 371 | } else { |
375 | - array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); |
|
372 | + array_push($results['fail'], "$iRow --> Wrong monthly mode"); |
|
376 | 373 | } |
374 | + } else { |
|
375 | + array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); |
|
376 | + } |
|
377 | 377 | |
378 | - if ($monthlyMode!="") { |
|
379 | - switch ($monthlyMode) { |
|
380 | - case 'dates': |
|
381 | - if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
382 | - if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
383 | - $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}'; |
|
384 | - } else { |
|
385 | - array_push($results['fail'], "$iRow --> Wrong monthly dates"); |
|
386 | - } |
|
387 | - } |
|
388 | - break; |
|
389 | - case 'nth': |
|
390 | - if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
391 | - if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
392 | - $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].','; |
|
393 | - } else { |
|
394 | - array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); |
|
395 | - } |
|
396 | - } else { |
|
397 | - array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); |
|
398 | - } |
|
378 | + if ($monthlyMode!="") { |
|
379 | + switch ($monthlyMode) { |
|
380 | + case 'dates': |
|
381 | + if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
382 | + if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
383 | + $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}'; |
|
384 | + } else { |
|
385 | + array_push($results['fail'], "$iRow --> Wrong monthly dates"); |
|
386 | + } |
|
387 | + } |
|
388 | + break; |
|
389 | + case 'nth': |
|
390 | + if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
391 | + if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
392 | + $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].','; |
|
393 | + } else { |
|
394 | + array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); |
|
395 | + } |
|
396 | + } else { |
|
397 | + array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); |
|
398 | + } |
|
399 | 399 | |
400 | - if ($curSchedule!="") { |
|
401 | - if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
402 | - if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
403 | - $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}'; |
|
404 | - } else { |
|
405 | - array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); |
|
406 | - } |
|
407 | - } else { |
|
408 | - array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); |
|
409 | - } |
|
410 | - } |
|
411 | - break; |
|
400 | + if ($curSchedule!="") { |
|
401 | + if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
402 | + if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
403 | + $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}'; |
|
404 | + } else { |
|
405 | + array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); |
|
412 | 406 | } |
407 | + } else { |
|
408 | + array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); |
|
409 | + } |
|
413 | 410 | } |
414 | 411 | break; |
415 | - default: |
|
416 | - $curSchedule = ""; |
|
412 | + } |
|
413 | + } |
|
417 | 414 | break; |
415 | + default: |
|
416 | + $curSchedule = ""; |
|
417 | + break; |
|
418 | 418 | } |
419 | 419 | } |
420 | 420 |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | Route4Me::setApiKey('11111111111111111111111111111111'); |
14 | 14 | |
15 | 15 | $AdressBookLocationParameters = AddressBookLocation::fromArray(array( |
16 | - "first_name" => "Test FirstName ".strval(rand(10000,99999)), |
|
17 | - "address_1" => "Test Address1 ".strval(rand(10000,99999)), |
|
16 | + "first_name" => "Test FirstName ".strval(rand(10000, 99999)), |
|
17 | + "address_1" => "Test Address1 ".strval(rand(10000, 99999)), |
|
18 | 18 | "cached_lat" => 38.024654, |
19 | 19 | "cached_lng" => -77.338814 |
20 | 20 | )); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $address_id = $abcResult["address_id"]; |
32 | 32 | } |
33 | 33 | |
34 | -assert($address_id != -1, "Cannot create an address book location. <br><br>"); |
|
34 | +assert($address_id!=-1, "Cannot create an address book location. <br><br>"); |
|
35 | 35 | |
36 | 36 | echo "Address Book Location with <b>address_id = ".strval($address_id)."</b> and <b>first_name = ".$abcResult['first_name']."</b> was successfully added<br>"; |
37 | 37 | |
@@ -41,6 +41,6 @@ discard block |
||
41 | 41 | |
42 | 42 | assert(isset($abcResult['first_name']), "Cannot update the address book location. <br><br>"); |
43 | 43 | |
44 | -assert($abcResult['first_name'] == 'Test Firstname Updated', "Cannot update the address book location. <br><br>"); |
|
44 | +assert($abcResult['first_name']=='Test Firstname Updated', "Cannot update the address book location. <br><br>"); |
|
45 | 45 | |
46 | 46 | echo "The field <b>first_name</b> in the address book location <b>".$address_id."</b> was update to <b>Test Firstname Updated</b> successfuly <br>"; |