@@ -28,7 +28,7 @@ |
||
| 28 | 28 | $route->parameters = new \stdClass(); |
| 29 | 29 | |
| 30 | 30 | $route->parameters = [ |
| 31 | - 'recompute_directions' => 1, |
|
| 31 | + 'recompute_directions' => 1, |
|
| 32 | 32 | ]; |
| 33 | 33 | |
| 34 | 34 | $route->httpheaders = 'Content-type: application/json'; |
@@ -21,8 +21,8 @@ |
||
| 21 | 21 | |
| 22 | 22 | // Get a route with the directions |
| 23 | 23 | $params = [ |
| 24 | - 'directions' => 1, |
|
| 25 | - 'route_id' => $route_id, |
|
| 24 | + 'directions' => 1, |
|
| 25 | + 'route_id' => $route_id, |
|
| 26 | 26 | ]; |
| 27 | 27 | |
| 28 | 28 | $routeResults = (array) $route->getRoutePoints($params); |
@@ -23,13 +23,13 @@ discard block |
||
| 23 | 23 | $count = 0; |
| 24 | 24 | |
| 25 | 25 | while ($route_id1 == $route_id2) { |
| 26 | - $route_id2 = $route->getRandomRouteId(0, 20); |
|
| 26 | + $route_id2 = $route->getRandomRouteId(0, 20); |
|
| 27 | 27 | |
| 28 | - ++$count; |
|
| 28 | + ++$count; |
|
| 29 | 29 | |
| 30 | - if ($count > 5) { |
|
| 31 | - break; |
|
| 32 | - } |
|
| 30 | + if ($count > 5) { |
|
| 31 | + break; |
|
| 32 | + } |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | echo "Route ID 1 -> $route_id1 <br> Route ID 2 -> $route_id2 <br>"; |
@@ -41,21 +41,21 @@ discard block |
||
| 41 | 41 | $depot = null; |
| 42 | 42 | |
| 43 | 43 | foreach ($addresses as $address) { |
| 44 | - if (isset($address->is_depot)) { |
|
| 45 | - if (true == $address->is_depot) { |
|
| 46 | - $depot = $address; |
|
| 47 | - break; |
|
| 48 | - } |
|
| 49 | - } |
|
| 44 | + if (isset($address->is_depot)) { |
|
| 45 | + if (true == $address->is_depot) { |
|
| 46 | + $depot = $address; |
|
| 47 | + break; |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // Merge the selected routes |
| 53 | 53 | $params = [ |
| 54 | - 'route_ids' => $route_id1.','.$route_id2, |
|
| 55 | - 'depot_address' => $depot->address, |
|
| 56 | - 'remove_origin' => false, |
|
| 57 | - 'depot_lat' => $depot->lat, |
|
| 58 | - 'depot_lng' => $depot->lng, |
|
| 54 | + 'route_ids' => $route_id1.','.$route_id2, |
|
| 55 | + 'depot_address' => $depot->address, |
|
| 56 | + 'remove_origin' => false, |
|
| 57 | + 'depot_lat' => $depot->lat, |
|
| 58 | + 'depot_lng' => $depot->lng, |
|
| 59 | 59 | ]; |
| 60 | 60 | |
| 61 | 61 | $result = $route->mergeRoutes($params); |
@@ -21,25 +21,25 @@ |
||
| 21 | 21 | |
| 22 | 22 | // Get a route with the path points |
| 23 | 23 | $params = [ |
| 24 | - 'route_path_output' => 'Points', |
|
| 25 | - 'route_id' => $route_id, |
|
| 24 | + 'route_path_output' => 'Points', |
|
| 25 | + 'route_id' => $route_id, |
|
| 26 | 26 | ]; |
| 27 | 27 | |
| 28 | 28 | $routeResults = (array) $route->getRoutePoints($params); |
| 29 | 29 | |
| 30 | 30 | if (isset($routeResults['addresses'])) { |
| 31 | - foreach ($routeResults['addresses'] as $key => $address) { |
|
| 32 | - $araddress = (array) $address; |
|
| 31 | + foreach ($routeResults['addresses'] as $key => $address) { |
|
| 32 | + $araddress = (array) $address; |
|
| 33 | 33 | |
| 34 | - if (isset($araddress['route_destination_id'])) { |
|
| 35 | - echo 'route_destination_id='.$araddress['route_destination_id'].'<br>'; |
|
| 36 | - } |
|
| 34 | + if (isset($araddress['route_destination_id'])) { |
|
| 35 | + echo 'route_destination_id='.$araddress['route_destination_id'].'<br>'; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - if (isset($araddress['path_to_next'])) { |
|
| 39 | - echo 'path_to_next:<br>'; |
|
| 40 | - Route4Me::simplePrint($araddress['path_to_next']); |
|
| 41 | - } |
|
| 38 | + if (isset($araddress['path_to_next'])) { |
|
| 39 | + echo 'path_to_next:<br>'; |
|
| 40 | + Route4Me::simplePrint($araddress['path_to_next']); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - echo '<br>'; |
|
| 44 | - } |
|
| 43 | + echo '<br>'; |
|
| 44 | + } |
|
| 45 | 45 | } |
@@ -29,8 +29,8 @@ |
||
| 29 | 29 | $route->parameters = new \stdClass(); |
| 30 | 30 | |
| 31 | 31 | $route->parameters->custom_fields = [ |
| 32 | - 'animal' => 'tiger', |
|
| 33 | - 'bird' => 'canary', |
|
| 32 | + 'animal' => 'tiger', |
|
| 33 | + 'bird' => 'canary', |
|
| 34 | 34 | ]; |
| 35 | 35 | |
| 36 | 36 | $route->httpheaders = 'Content-type: application/json'; |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | // The example refers to the process of searching for the specified text throughout all routes, belonging to the user's account. |
| 12 | 12 | |
| 13 | 13 | $RouteParameters = [ |
| 14 | - 'query' => 'Saturday 2', |
|
| 14 | + 'query' => 'Saturday 2', |
|
| 15 | 15 | ]; |
| 16 | 16 | |
| 17 | 17 | $route = new Route(); |
@@ -19,15 +19,15 @@ discard block |
||
| 19 | 19 | $routeResults = $route->getRoutes($RouteParameters); |
| 20 | 20 | |
| 21 | 21 | foreach ($routeResults as $routeResult) { |
| 22 | - $results = (array) $routeResult; |
|
| 22 | + $results = (array) $routeResult; |
|
| 23 | 23 | |
| 24 | - if (isset($results['route_id'])) { |
|
| 25 | - echo 'Route ID - > '.$results['route_id'].'<br>'; |
|
| 26 | - } |
|
| 24 | + if (isset($results['route_id'])) { |
|
| 25 | + echo 'Route ID - > '.$results['route_id'].'<br>'; |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - if (isset($results['parameters']->route_name)) { |
|
| 29 | - echo 'Route name - > '.$results['parameters']->route_name.'<br>'; |
|
| 30 | - } |
|
| 28 | + if (isset($results['parameters']->route_name)) { |
|
| 29 | + echo 'Route name - > '.$results['parameters']->route_name.'<br>'; |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - echo '<br>'; |
|
| 32 | + echo '<br>'; |
|
| 33 | 33 | } |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | // Select a route with more than 4 addresses. |
| 17 | 17 | $routesParams = [ |
| 18 | - 'offset' => 0, |
|
| 19 | - 'limit' => 20, |
|
| 18 | + 'offset' => 0, |
|
| 19 | + 'limit' => 20, |
|
| 20 | 20 | ]; |
| 21 | 21 | |
| 22 | 22 | $routes = $route->getRoutes($routesParams); |
@@ -24,12 +24,12 @@ discard block |
||
| 24 | 24 | $selectedRoute = null; |
| 25 | 25 | |
| 26 | 26 | foreach ($routes as $route1) { |
| 27 | - if (isset($route1->destination_count)) { |
|
| 28 | - if ($route1->destination_count > 4) { |
|
| 29 | - $selectedRoute = $route->getRoutes(['route_id' => $route1->route_id]); |
|
| 30 | - break; |
|
| 31 | - } |
|
| 32 | - } |
|
| 27 | + if (isset($route1->destination_count)) { |
|
| 28 | + if ($route1->destination_count > 4) { |
|
| 29 | + $selectedRoute = $route->getRoutes(['route_id' => $route1->route_id]); |
|
| 30 | + break; |
|
| 31 | + } |
|
| 32 | + } |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | assert(!is_null($selectedRoute), "Cannot select a route with more than 4 addresses"); |
@@ -41,19 +41,19 @@ discard block |
||
| 41 | 41 | echo "Route ID-> $routeID, Route destination ID -> $routeDestinationID <br>"; |
| 42 | 42 | |
| 43 | 43 | $params = [ |
| 44 | - 'route_id' => $routeID, |
|
| 45 | - 'route_destination_id' => $routeDestinationID, |
|
| 46 | - 'addresses' => [ |
|
| 47 | - '0' => [ |
|
| 48 | - 'route_destination_id' => $routeDestinationID, |
|
| 49 | - 'sequence_no' => 3, |
|
| 50 | - ], |
|
| 51 | - ], |
|
| 44 | + 'route_id' => $routeID, |
|
| 45 | + 'route_destination_id' => $routeDestinationID, |
|
| 46 | + 'addresses' => [ |
|
| 47 | + '0' => [ |
|
| 48 | + 'route_destination_id' => $routeDestinationID, |
|
| 49 | + 'sequence_no' => 3, |
|
| 50 | + ], |
|
| 51 | + ], |
|
| 52 | 52 | ]; |
| 53 | 53 | |
| 54 | 54 | $response = $route->resequenceRoute($params); |
| 55 | 55 | |
| 56 | 56 | foreach ($response['addresses'] as $address) { |
| 57 | - Route4Me::simplePrint($address); |
|
| 58 | - echo '<br>'; |
|
| 57 | + Route4Me::simplePrint($address); |
|
| 58 | + echo '<br>'; |
|
| 59 | 59 | } |
@@ -14,15 +14,15 @@ |
||
| 14 | 14 | $orderCustomField = new OrderCustomField(); |
| 15 | 15 | |
| 16 | 16 | $orderCustomFieldParameters = OrderCustomField::fromArray([ |
| 17 | - 'order_custom_field_name' => 'CustomField4', |
|
| 18 | - 'order_custom_field_label' => 'Custom Field 4', |
|
| 19 | - 'order_custom_field_type' => 'checkbox', |
|
| 20 | - 'order_custom_field_type_info' => ['short_label' => 'cFl4'] |
|
| 17 | + 'order_custom_field_name' => 'CustomField4', |
|
| 18 | + 'order_custom_field_label' => 'Custom Field 4', |
|
| 19 | + 'order_custom_field_type' => 'checkbox', |
|
| 20 | + 'order_custom_field_type_info' => ['short_label' => 'cFl4'] |
|
| 21 | 21 | ]); |
| 22 | 22 | |
| 23 | 23 | $response = $orderCustomField->addOrderCustomUserField($orderCustomFieldParameters); |
| 24 | 24 | |
| 25 | 25 | foreach ($response as $key => $orderCustomField) { |
| 26 | - Route4Me::simplePrint($orderCustomField); |
|
| 27 | - echo '<br>'; |
|
| 26 | + Route4Me::simplePrint($orderCustomField); |
|
| 27 | + echo '<br>'; |
|
| 28 | 28 | } |
@@ -14,15 +14,15 @@ |
||
| 14 | 14 | $orderCustomField = new OrderCustomField(); |
| 15 | 15 | |
| 16 | 16 | $orderCustomFieldParameters = OrderCustomField::fromArray([ |
| 17 | - 'order_custom_field_id' => 182, |
|
| 18 | - 'order_custom_field_label' => 'ustom Field 44', |
|
| 19 | - 'order_custom_field_type' => 'checkbox', |
|
| 20 | - 'order_custom_field_type_info' => ['short_label' => 'cFl44'] |
|
| 17 | + 'order_custom_field_id' => 182, |
|
| 18 | + 'order_custom_field_label' => 'ustom Field 44', |
|
| 19 | + 'order_custom_field_type' => 'checkbox', |
|
| 20 | + 'order_custom_field_type_info' => ['short_label' => 'cFl44'] |
|
| 21 | 21 | ]); |
| 22 | 22 | |
| 23 | 23 | $response = $orderCustomField->updateOrderCustomUserField($orderCustomFieldParameters); |
| 24 | 24 | |
| 25 | 25 | foreach ($response as $key => $orderCustomField) { |
| 26 | - Route4Me::simplePrint($orderCustomField); |
|
| 27 | - echo '<br>'; |
|
| 26 | + Route4Me::simplePrint($orderCustomField); |
|
| 27 | + echo '<br>'; |
|
| 28 | 28 | } |