@@ -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,15 +22,15 @@ 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'])) { |
|
28 | - echo "Route ID - > " . $results['route_id'] . "<br>"; |
|
29 | - } |
|
27 | + if (isset($results['route_id'])) { |
|
28 | + echo "Route ID - > " . $results['route_id'] . "<br>"; |
|
29 | + } |
|
30 | 30 | |
31 | - if (isset($results['parameters']->route_name)) { |
|
32 | - echo "Route name - > ".$results['parameters']->route_name."<br>"; |
|
33 | - } |
|
31 | + if (isset($results['parameters']->route_name)) { |
|
32 | + echo "Route name - > ".$results['parameters']->route_name."<br>"; |
|
33 | + } |
|
34 | 34 | |
35 | - echo "<br>"; |
|
35 | + echo "<br>"; |
|
36 | 36 | } |
@@ -1,7 +1,7 @@ discard block |
||
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; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $results = (array)$routeResult; |
26 | 26 | |
27 | 27 | if (isset($results['route_id'])) { |
28 | - echo "Route ID - > " . $results['route_id'] . "<br>"; |
|
28 | + echo "Route ID - > ".$results['route_id']."<br>"; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | if (isset($results['parameters']->route_name)) { |
@@ -24,10 +24,10 @@ |
||
24 | 24 | |
25 | 25 | // Remove an optimization |
26 | 26 | $params = array( |
27 | - "optimization_problem_ids" => array( |
|
28 | - "0" => $optimizationProblemId |
|
29 | - ), |
|
30 | - "redirect" => 0 |
|
27 | + "optimization_problem_ids" => array( |
|
28 | + "0" => $optimizationProblemId |
|
29 | + ), |
|
30 | + "redirect" => 0 |
|
31 | 31 | ); |
32 | 32 | |
33 | 33 | $result = $optimization->removeOptimization($params); |
@@ -18,38 +18,38 @@ |
||
18 | 18 | $vehicle = new Vehicle(); |
19 | 19 | |
20 | 20 | $vehicleParameters = Vehicle::fromArray(array( |
21 | - 'vehicle_alias' => 'Peterbilt 579', |
|
22 | - 'vehicle_vin' => '1NP5DB9X93N507873', |
|
23 | - 'vehicle_license_plate' => 'PPV7516', |
|
24 | - 'license_start_date' => '2017-06-05', |
|
25 | - 'license_end_date' => '2021-08-14', |
|
26 | - 'vehicle_model' => '579', |
|
27 | - 'vehicle_model_year' => 2015, |
|
28 | - 'vehicle_year_acquired' => 2018, |
|
29 | - 'vehicle_reg_country_id' => '223', |
|
30 | - 'vehicle_make' => 'Peterbilt', |
|
31 | - 'vehicle_type_id' => 'tractor_trailer', |
|
32 | - 'has_trailer' => true, |
|
33 | - 'vehicle_axle_count' => 5, |
|
34 | - 'mpg_city' => 6, |
|
35 | - 'mpg_highway' => 12, |
|
36 | - 'fuel_type' => 'diesel', |
|
37 | - 'height_inches' => 114, |
|
38 | - 'height_metric' => 290, |
|
39 | - 'weight_lb' => 50350, |
|
40 | - 'maxWeightPerAxleGroupInPounds' => 40000, |
|
41 | - 'max_weight_per_axle_group_metric' => 18000, |
|
42 | - 'widthInInches' => 102, |
|
43 | - 'width_metric' => 258, |
|
44 | - 'lengthInInches' => 640, |
|
45 | - 'length_metric' => 1625, |
|
46 | - 'Use53FootTrailerRouting' => 'YES', |
|
47 | - 'UseTruckRestrictions' => 'YES', |
|
48 | - 'DividedHighwayAvoidPreference' => 'STRONG_AVOID', |
|
49 | - 'FreewayAvoidPreference' => 'STRONG_AVOID', |
|
50 | - 'truck_config' => '53_SEMI_TRAILER', |
|
51 | - 'InternationalBordersOpen' => 'YES', |
|
52 | - 'purchased_new' => true |
|
21 | + 'vehicle_alias' => 'Peterbilt 579', |
|
22 | + 'vehicle_vin' => '1NP5DB9X93N507873', |
|
23 | + 'vehicle_license_plate' => 'PPV7516', |
|
24 | + 'license_start_date' => '2017-06-05', |
|
25 | + 'license_end_date' => '2021-08-14', |
|
26 | + 'vehicle_model' => '579', |
|
27 | + 'vehicle_model_year' => 2015, |
|
28 | + 'vehicle_year_acquired' => 2018, |
|
29 | + 'vehicle_reg_country_id' => '223', |
|
30 | + 'vehicle_make' => 'Peterbilt', |
|
31 | + 'vehicle_type_id' => 'tractor_trailer', |
|
32 | + 'has_trailer' => true, |
|
33 | + 'vehicle_axle_count' => 5, |
|
34 | + 'mpg_city' => 6, |
|
35 | + 'mpg_highway' => 12, |
|
36 | + 'fuel_type' => 'diesel', |
|
37 | + 'height_inches' => 114, |
|
38 | + 'height_metric' => 290, |
|
39 | + 'weight_lb' => 50350, |
|
40 | + 'maxWeightPerAxleGroupInPounds' => 40000, |
|
41 | + 'max_weight_per_axle_group_metric' => 18000, |
|
42 | + 'widthInInches' => 102, |
|
43 | + 'width_metric' => 258, |
|
44 | + 'lengthInInches' => 640, |
|
45 | + 'length_metric' => 1625, |
|
46 | + 'Use53FootTrailerRouting' => 'YES', |
|
47 | + 'UseTruckRestrictions' => 'YES', |
|
48 | + 'DividedHighwayAvoidPreference' => 'STRONG_AVOID', |
|
49 | + 'FreewayAvoidPreference' => 'STRONG_AVOID', |
|
50 | + 'truck_config' => '53_SEMI_TRAILER', |
|
51 | + 'InternationalBordersOpen' => 'YES', |
|
52 | + 'purchased_new' => true |
|
53 | 53 | )); |
54 | 54 | |
55 | 55 | $result = $vehicle->createVehicle($vehicleParameters); |
@@ -23,17 +23,17 @@ |
||
23 | 23 | |
24 | 24 | // Update the vehicle |
25 | 25 | $vehicleParameters = Vehicle::fromArray(array( |
26 | - 'vehicle_id' => $randomVehicleID, |
|
27 | - 'vehicle_model_year' => 2013, |
|
28 | - 'vehicle_year_acquired' => 2016, |
|
29 | - 'vehicle_reg_country_id' => '223', |
|
30 | - 'vehicle_make' => 'Ford', |
|
31 | - 'vehicle_axle_count' => 3, |
|
32 | - 'mpg_city' => 11, |
|
33 | - 'mpg_highway' => 17, |
|
34 | - 'fuel_type' => 'unleaded 93', |
|
35 | - 'height_inches' => 74, |
|
36 | - 'weight_lb' => 2098 |
|
26 | + 'vehicle_id' => $randomVehicleID, |
|
27 | + 'vehicle_model_year' => 2013, |
|
28 | + 'vehicle_year_acquired' => 2016, |
|
29 | + 'vehicle_reg_country_id' => '223', |
|
30 | + 'vehicle_make' => 'Ford', |
|
31 | + 'vehicle_axle_count' => 3, |
|
32 | + 'mpg_city' => 11, |
|
33 | + 'mpg_highway' => 17, |
|
34 | + 'fuel_type' => 'unleaded 93', |
|
35 | + 'height_inches' => 74, |
|
36 | + 'weight_lb' => 2098 |
|
37 | 37 | )); |
38 | 38 | |
39 | 39 | $result = $vehicle->updateVehicle($vehicleParameters); |
@@ -27,16 +27,16 @@ discard block |
||
27 | 27 | // Set GPS postion to the selected route |
28 | 28 | // Set right member_id corresponding to the API key |
29 | 29 | $params = TrackSetParams::fromArray(array( |
30 | - 'format' => Format::SERIALIZED, |
|
31 | - 'route_id' => $routeId, |
|
32 | - 'member_id' => 105323, |
|
33 | - 'course' => 3, |
|
34 | - 'speed' => 100, |
|
35 | - 'lat' => 41.8927521, |
|
36 | - 'lng' => -109.0803888, |
|
37 | - 'device_type' => DeviceType::IPHONE, |
|
38 | - 'device_guid' => 'qweqweqwe', |
|
39 | - 'device_timestamp' => date('Y-m-d H:i:s') |
|
30 | + 'format' => Format::SERIALIZED, |
|
31 | + 'route_id' => $routeId, |
|
32 | + 'member_id' => 105323, |
|
33 | + 'course' => 3, |
|
34 | + 'speed' => 100, |
|
35 | + 'lat' => 41.8927521, |
|
36 | + 'lng' => -109.0803888, |
|
37 | + 'device_type' => DeviceType::IPHONE, |
|
38 | + 'device_guid' => 'qweqweqwe', |
|
39 | + 'device_timestamp' => date('Y-m-d H:i:s') |
|
40 | 40 | )); |
41 | 41 | |
42 | 42 | $status = Track::set($params); |
@@ -46,24 +46,24 @@ discard block |
||
46 | 46 | assert($status['status'], "Can't send GPS position to the selected route"); |
47 | 47 | |
48 | 48 | if (!$status) { |
49 | - echo "Setting of GPS position failed"; |
|
50 | - return; |
|
49 | + echo "Setting of GPS position failed"; |
|
50 | + return; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | $params = array( |
54 | - 'route_id' => $routeId, |
|
55 | - 'device_tracking_history' => '1' |
|
54 | + 'route_id' => $routeId, |
|
55 | + 'device_tracking_history' => '1' |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | $result = $route->GetLastLocation($params); |
59 | 59 | |
60 | 60 | if (isset($result->tracking_history)) { |
61 | - foreach ($result->tracking_history as $history) { |
|
62 | - echo "Speed --> ".$history['s']."<br>"; |
|
63 | - echo "course --> ".$history['d']."<br>"; |
|
64 | - echo "Timestamp --> ".$history['ts_friendly']."<br>"; |
|
65 | - echo "Latitude --> ".$history['lt']."<br>"; |
|
66 | - echo "Longitude --> ".$history['lg']."<br>"; |
|
67 | - echo "========================================<br><br>"; |
|
68 | - } |
|
61 | + foreach ($result->tracking_history as $history) { |
|
62 | + echo "Speed --> ".$history['s']."<br>"; |
|
63 | + echo "course --> ".$history['d']."<br>"; |
|
64 | + echo "Timestamp --> ".$history['ts_friendly']."<br>"; |
|
65 | + echo "Latitude --> ".$history['lt']."<br>"; |
|
66 | + echo "Longitude --> ".$history['lg']."<br>"; |
|
67 | + echo "========================================<br><br>"; |
|
68 | + } |
|
69 | 69 | } |
@@ -27,16 +27,16 @@ discard block |
||
27 | 27 | // Set GPS postion to the selected route |
28 | 28 | // Set right member_id corresponding to the API key |
29 | 29 | $params = TrackSetParams::fromArray(array( |
30 | - 'format' => Format::SERIALIZED, |
|
31 | - 'route_id' => $routeId, |
|
32 | - 'member_id' => 1, |
|
33 | - 'course' => 1, |
|
34 | - 'speed' => 120, |
|
35 | - 'lat' => 41.8927521, |
|
36 | - 'lng' => -109.0803888, |
|
37 | - 'device_type' => 'android_phone', |
|
38 | - 'device_guid' => 'qweqweqwe', |
|
39 | - 'device_timestamp' => date('Y-m-d H:i:s', strtotime('-2 day')) |
|
30 | + 'format' => Format::SERIALIZED, |
|
31 | + 'route_id' => $routeId, |
|
32 | + 'member_id' => 1, |
|
33 | + 'course' => 1, |
|
34 | + 'speed' => 120, |
|
35 | + 'lat' => 41.8927521, |
|
36 | + 'lng' => -109.0803888, |
|
37 | + 'device_type' => 'android_phone', |
|
38 | + 'device_guid' => 'qweqweqwe', |
|
39 | + 'device_timestamp' => date('Y-m-d H:i:s', strtotime('-2 day')) |
|
40 | 40 | )); |
41 | 41 | |
42 | 42 | $status = Track::set($params); |
@@ -50,20 +50,20 @@ discard block |
||
50 | 50 | $endDate = time() + 1 * 24 * 3600; |
51 | 51 | |
52 | 52 | $params = array( |
53 | - 'route_id' => $routeId, |
|
54 | - 'format' => Format::JSON, |
|
55 | - 'time_period' => 'custom', |
|
56 | - 'start_date' => $startDate, |
|
57 | - 'end_date' => $endDate |
|
53 | + 'route_id' => $routeId, |
|
54 | + 'format' => Format::JSON, |
|
55 | + 'time_period' => 'custom', |
|
56 | + 'start_date' => $startDate, |
|
57 | + 'end_date' => $endDate |
|
58 | 58 | ); |
59 | 59 | |
60 | 60 | $result = $route->GetTrackingHistoryFromTimeRange($params); |
61 | 61 | |
62 | 62 | foreach ($result as $key => $value) |
63 | 63 | { |
64 | - if (is_array($value)) { |
|
65 | - Route4Me::simplePrint($value); |
|
66 | - } else { |
|
67 | - echo "$key => $value <br>"; |
|
68 | - } |
|
64 | + if (is_array($value)) { |
|
65 | + Route4Me::simplePrint($value); |
|
66 | + } else { |
|
67 | + echo "$key => $value <br>"; |
|
68 | + } |
|
69 | 69 | } |
@@ -29,10 +29,10 @@ |
||
29 | 29 | |
30 | 30 | // Remove 2 random orders |
31 | 31 | $orderParameters = Order::fromArray(array( |
32 | - 'order_ids' => array( |
|
33 | - 0 => $randomOrderID1, |
|
34 | - 1 => $randomOrderID2, |
|
35 | - ) |
|
32 | + 'order_ids' => array( |
|
33 | + 0 => $randomOrderID1, |
|
34 | + 1 => $randomOrderID2, |
|
35 | + ) |
|
36 | 36 | )); |
37 | 37 | |
38 | 38 | $response = $order->removeOrder($orderParameters); |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | |
29 | 29 | // Add an address note |
30 | 30 | $noteParameters = array( |
31 | - "route_id" => $route_id, |
|
32 | - "address_id" => $route_destination_id, |
|
33 | - "dev_lat" => 33.132675170898, |
|
34 | - "dev_lng" => -83.244743347168, |
|
35 | - "device_type" => "web", |
|
36 | - "strUpdateType" => "dropoff", |
|
37 | - "strNoteContents" => "Test ".time() |
|
31 | + "route_id" => $route_id, |
|
32 | + "address_id" => $route_destination_id, |
|
33 | + "dev_lat" => 33.132675170898, |
|
34 | + "dev_lng" => -83.244743347168, |
|
35 | + "device_type" => "web", |
|
36 | + "strUpdateType" => "dropoff", |
|
37 | + "strNoteContents" => "Test ".time() |
|
38 | 38 | ); |
39 | 39 | |
40 | 40 | $address = new Address(); |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | |
46 | 46 | // Get address notes |
47 | 47 | $noteParameters = array( |
48 | - "route_id" => $route_id, |
|
49 | - "route_destination_id" => $route_destination_id |
|
48 | + "route_id" => $route_id, |
|
49 | + "route_destination_id" => $route_destination_id |
|
50 | 50 | ); |
51 | 51 | |
52 | 52 | $address = new Address(); |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | echo "Destination note count --> ".$notes['destination_note_count']."<br>"; |
57 | 57 | |
58 | 58 | foreach ($notes['notes'] as $note) { |
59 | - echo "========== Notes ==================<br>"; |
|
60 | - echo "note_id --> ".$note['note_id']."<br>"; |
|
61 | - $content = isset($note['contents']) ? $note['contents'] : ""; |
|
62 | - if (strlen($content)>0) { |
|
63 | - echo "contents --> $content"."<br>"; |
|
64 | - } |
|
59 | + echo "========== Notes ==================<br>"; |
|
60 | + echo "note_id --> ".$note['note_id']."<br>"; |
|
61 | + $content = isset($note['contents']) ? $note['contents'] : ""; |
|
62 | + if (strlen($content)>0) { |
|
63 | + echo "contents --> $content"."<br>"; |
|
64 | + } |
|
65 | 65 | } |
@@ -18,14 +18,14 @@ |
||
18 | 18 | |
19 | 19 | $territoryParams['type'] = TerritoryTypes::CIRCLE; |
20 | 20 | $territoryParams['data'] = array( |
21 | - "37.569752822786455,-77.47833251953125", |
|
22 | - "5000" |
|
21 | + "37.569752822786455,-77.47833251953125", |
|
22 | + "5000" |
|
23 | 23 | ); |
24 | 24 | |
25 | 25 | $TerritoryParameters = Territory::fromArray(array( |
26 | - "territory_name" => "Test Territory ".strval(rand(10000, 99999)), |
|
27 | - "territory_color" => "ff7700", |
|
28 | - "territory" => $territoryParams |
|
26 | + "territory_name" => "Test Territory ".strval(rand(10000, 99999)), |
|
27 | + "territory_color" => "ff7700", |
|
28 | + "territory" => $territoryParams |
|
29 | 29 | )); |
30 | 30 | |
31 | 31 | $territory = new Territory(); |