@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | // The example refers to the process of searching for the specified text throughout all routes, belonging to the user's account. |
14 | 14 | |
15 | 15 | $RouteParameters = array( |
16 | - "query" => 'Automated' |
|
16 | + "query" => 'Automated' |
|
17 | 17 | ); |
18 | 18 | |
19 | 19 | $route = new Route(); |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | |
23 | 23 | foreach ($routeResults as $routeResult) |
24 | 24 | { |
25 | - $results = (array)$routeResult; |
|
25 | + $results = (array)$routeResult; |
|
26 | 26 | |
27 | - if (isset($results['route_id'])) echo "Route ID - > " . $results['route_id'] . "<br>"; |
|
27 | + if (isset($results['route_id'])) echo "Route ID - > " . $results['route_id'] . "<br>"; |
|
28 | 28 | |
29 | - if (isset($results['parameters']->route_name)) echo "Route name - > " . $results['parameters']->route_name . "<br>"; |
|
29 | + if (isset($results['parameters']->route_name)) echo "Route name - > " . $results['parameters']->route_name . "<br>"; |
|
30 | 30 | |
31 | - echo "<br>"; |
|
31 | + echo "<br>"; |
|
32 | 32 | } |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | |
19 | 19 | // Select a route with more than 4 addresses. |
20 | 20 | $routesParams = array( |
21 | - "offset" => 0, |
|
22 | - "limit" => 20 |
|
21 | + "offset" => 0, |
|
22 | + "limit" => 20 |
|
23 | 23 | ); |
24 | 24 | |
25 | 25 | $routes = $route->getRoutes(null,$routesParams); |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | $selectedRoute = null; |
28 | 28 | |
29 | 29 | foreach ($routes as $route1) { |
30 | - if (isset($route1->destination_count)) { |
|
31 | - if ($route1->destination_count>4) { |
|
32 | - $selectedRoute = $route->getRoutes($route1->route_id); |
|
33 | - break; |
|
34 | - } |
|
35 | - } |
|
30 | + if (isset($route1->destination_count)) { |
|
31 | + if ($route1->destination_count>4) { |
|
32 | + $selectedRoute = $route->getRoutes($route1->route_id); |
|
33 | + break; |
|
34 | + } |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | assert(!is_null($selectedRoute), "Can't select a route with more than 4 addresses"); |
@@ -44,19 +44,19 @@ discard block |
||
44 | 44 | echo "Route ID-> $routeID, Route destination ID -> $routeDestinationID <br>"; |
45 | 45 | |
46 | 46 | $params = array( |
47 | - "route_id" => $routeID, |
|
48 | - "route_destination_id" => $routeDestinationID, |
|
49 | - "addresses" => array( |
|
50 | - "0" => array( |
|
51 | - "route_destination_id" => $routeDestinationID, |
|
52 | - "sequence_no" => 3 |
|
53 | - ) |
|
54 | - ) |
|
47 | + "route_id" => $routeID, |
|
48 | + "route_destination_id" => $routeDestinationID, |
|
49 | + "addresses" => array( |
|
50 | + "0" => array( |
|
51 | + "route_destination_id" => $routeDestinationID, |
|
52 | + "sequence_no" => 3 |
|
53 | + ) |
|
54 | + ) |
|
55 | 55 | ); |
56 | 56 | |
57 | 57 | $response = $route->resequenceRoute($params); |
58 | 58 | |
59 | 59 | foreach ($response['addresses'] as $address) { |
60 | - Route4Me::simplePrint($address); |
|
61 | - echo "<br>"; |
|
60 | + Route4Me::simplePrint($address); |
|
61 | + echo "<br>"; |
|
62 | 62 | } |
@@ -21,9 +21,9 @@ |
||
21 | 21 | |
22 | 22 | // Share a route with an email |
23 | 23 | $params = array( |
24 | - "route_id" => $route_id, |
|
25 | - "response_format" => "json", |
|
26 | - "recipient_email" => "[email protected]" |
|
24 | + "route_id" => $route_id, |
|
25 | + "response_format" => "json", |
|
26 | + "recipient_email" => "[email protected]" |
|
27 | 27 | ); |
28 | 28 | |
29 | 29 | $result = $route->shareRoute($params); |
@@ -30,10 +30,10 @@ |
||
30 | 30 | $route->parameters = new \stdClass(); |
31 | 31 | |
32 | 32 | $route->parameters = array( |
33 | - "member_id" => $randomRoute->member_id, |
|
34 | - "optimize" => "Distance", |
|
35 | - "route_max_duration" => "82400", |
|
36 | - "route_name" => "updated " . date('m-d-Y') |
|
33 | + "member_id" => $randomRoute->member_id, |
|
34 | + "optimize" => "Distance", |
|
35 | + "route_max_duration" => "82400", |
|
36 | + "route_name" => "updated " . date('m-d-Y') |
|
37 | 37 | ); |
38 | 38 | |
39 | 39 | $route->httpheaders = 'Content-type: application/json'; |
@@ -23,23 +23,23 @@ |
||
23 | 23 | |
24 | 24 | // Get a route with the path points |
25 | 25 | $params = array( |
26 | - "route_path_output" => "Points", |
|
27 | - "compress_path_points" => TRUE |
|
26 | + "route_path_output" => "Points", |
|
27 | + "compress_path_points" => TRUE |
|
28 | 28 | ); |
29 | 29 | |
30 | 30 | $routeResults = (array)$route->getRoutePoints($route_id,$params); |
31 | 31 | |
32 | 32 | if (isset($routeResults['addresses'])) { |
33 | - foreach ($routeResults['addresses'] as $key => $address) { |
|
34 | - $araddress = (array)$address; |
|
33 | + foreach ($routeResults['addresses'] as $key => $address) { |
|
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'])) echo "route_destination_id=".$araddress['route_destination_id']."<br>"; |
|
37 | 37 | |
38 | - if (isset($araddress['path_to_next'])) { |
|
39 | - echo "path_to_next:<br>"; |
|
40 | - Route4Me::simplePrint((array)$araddress['path_to_next']); |
|
41 | - } |
|
38 | + if (isset($araddress['path_to_next'])) { |
|
39 | + echo "path_to_next:<br>"; |
|
40 | + Route4Me::simplePrint((array)$araddress['path_to_next']); |
|
41 | + } |
|
42 | 42 | |
43 | - echo "<br>"; |
|
44 | - } |
|
43 | + echo "<br>"; |
|
44 | + } |
|
45 | 45 | } |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | // Select a terriotry with the addresses from the list |
19 | 19 | $params = array( |
20 | - "offset" => 0, |
|
21 | - "limit" => 50, |
|
22 | - "addresses" => 1 |
|
20 | + "offset" => 0, |
|
21 | + "limit" => 50, |
|
22 | + "addresses" => 1 |
|
23 | 23 | ); |
24 | 24 | |
25 | 25 | $results = $territory->getTerritories($params); |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | $territory1 = null; |
29 | 29 | |
30 | 30 | foreach ($results as $terr) { |
31 | - if (isset($terr['addresses'])) { |
|
32 | - if (sizeof($terr['addresses'])>0) { |
|
33 | - $territory1 = $terr; |
|
34 | - break; |
|
35 | - } |
|
36 | - } |
|
31 | + if (isset($terr['addresses'])) { |
|
32 | + if (sizeof($terr['addresses'])>0) { |
|
33 | + $territory1 = $terr; |
|
34 | + break; |
|
35 | + } |
|
36 | + } |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | assert(isset($territory1['territory_id']), "Can't retrieve a random territory ID"); |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | |
44 | 44 | // Get a territory with the addresses |
45 | 45 | $params = array( |
46 | - "territory_id" => $territory_id, |
|
47 | - "addresses" => 1 |
|
46 | + "territory_id" => $territory_id, |
|
47 | + "addresses" => 1 |
|
48 | 48 | ); |
49 | 49 | |
50 | 50 | $result1 = $territory->getTerritory($params); |
@@ -13,13 +13,13 @@ |
||
13 | 13 | $territory = new Territory(); |
14 | 14 | |
15 | 15 | $queryparameters = array ( |
16 | - "offset" => 0, |
|
17 | - "limit" => 20 |
|
16 | + "offset" => 0, |
|
17 | + "limit" => 20 |
|
18 | 18 | ); |
19 | 19 | |
20 | 20 | $response = $territory->getTerritories($queryparameters); |
21 | 21 | |
22 | 22 | foreach ($response as $terr1) { |
23 | 23 | Route4Me::simplePrint($terr1, true); |
24 | - echo "<br>"; |
|
24 | + echo "<br>"; |
|
25 | 25 | } |
@@ -26,23 +26,23 @@ discard block |
||
26 | 26 | |
27 | 27 | $addresses = array(); |
28 | 28 | foreach($json as $address) { |
29 | - $addresses[] = Address::fromArray($address); |
|
29 | + $addresses[] = Address::fromArray($address); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $parameters = RouteParameters::fromArray(array( |
33 | - "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
|
34 | - "route_name" => "Multiple Depot, Multiple Driver, Time Window", |
|
35 | - "route_date" => time() + 24*60*60, |
|
36 | - "route_time" => 60 * 60 * 7, |
|
37 | - "rt" => TRUE, |
|
38 | - "distance_unit" => DistanceUnit::MILES, |
|
39 | - "device_type" => DeviceType::WEB, |
|
40 | - "optimize" => OptimizationType::TIME, |
|
41 | - "metric" => Metric::GEODESIC, |
|
42 | - "route_max_duration" => 86400 * 3, |
|
43 | - "travel_mode" => TravelMode::DRIVING, |
|
44 | - "vehicle_capacity" => 99, |
|
45 | - "vehicle_max_distance_mi" => 99999 |
|
33 | + "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
|
34 | + "route_name" => "Multiple Depot, Multiple Driver, Time Window", |
|
35 | + "route_date" => time() + 24*60*60, |
|
36 | + "route_time" => 60 * 60 * 7, |
|
37 | + "rt" => TRUE, |
|
38 | + "distance_unit" => DistanceUnit::MILES, |
|
39 | + "device_type" => DeviceType::WEB, |
|
40 | + "optimize" => OptimizationType::TIME, |
|
41 | + "metric" => Metric::GEODESIC, |
|
42 | + "route_max_duration" => 86400 * 3, |
|
43 | + "travel_mode" => TravelMode::DRIVING, |
|
44 | + "vehicle_capacity" => 99, |
|
45 | + "vehicle_max_distance_mi" => 99999 |
|
46 | 46 | )); |
47 | 47 | |
48 | 48 | $optimizationParams = new OptimizationProblemParams; |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | $problem = OptimizationProblem::optimize($optimizationParams); |
53 | 53 | |
54 | 54 | foreach ((array)$problem as $key => $value) { |
55 | - if (is_string($value)) { |
|
56 | - echo $key." --> ".$value."<br>"; |
|
57 | - } else { |
|
58 | - echo "************ $key ************* <br>"; |
|
59 | - Route4Me::simplePrint((array)$value, true); |
|
60 | - echo "******************************* <br>"; |
|
61 | - } |
|
55 | + if (is_string($value)) { |
|
56 | + echo $key." --> ".$value."<br>"; |
|
57 | + } else { |
|
58 | + echo "************ $key ************* <br>"; |
|
59 | + Route4Me::simplePrint((array)$value, true); |
|
60 | + echo "******************************* <br>"; |
|
61 | + } |
|
62 | 62 | } |
63 | 63 |
@@ -8,18 +8,18 @@ |
||
8 | 8 | |
9 | 9 | class Track extends Common |
10 | 10 | { |
11 | - public static function set(TrackSetParams $param) |
|
12 | - { |
|
13 | - $query = array_merge($param->toArray(), array( |
|
14 | - 'api_key' => Route4Me::getApiKey() |
|
15 | - )); |
|
11 | + public static function set(TrackSetParams $param) |
|
12 | + { |
|
13 | + $query = array_merge($param->toArray(), array( |
|
14 | + 'api_key' => Route4Me::getApiKey() |
|
15 | + )); |
|
16 | 16 | |
17 | - $json = Route4Me::makeRequst(array( |
|
18 | - 'url' => Endpoint::TRACK_SET, |
|
19 | - 'method' => 'GET', |
|
20 | - 'query' => $query |
|
21 | - )); |
|
17 | + $json = Route4Me::makeRequst(array( |
|
18 | + 'url' => Endpoint::TRACK_SET, |
|
19 | + 'method' => 'GET', |
|
20 | + 'query' => $query |
|
21 | + )); |
|
22 | 22 | |
23 | - return $json; |
|
24 | - } |
|
23 | + return $json; |
|
24 | + } |
|
25 | 25 | } |