@@ -12,8 +12,8 @@ |
||
| 12 | 12 | |
| 13 | 13 | // Get reandom address book location |
| 14 | 14 | $AddressBookLocationParameters = [ |
| 15 | - 'limit' => 30, |
|
| 16 | - 'offset' => 0, |
|
| 15 | + 'limit' => 30, |
|
| 16 | + 'offset' => 0, |
|
| 17 | 17 | ]; |
| 18 | 18 | |
| 19 | 19 | $randomLocation = $abLocation->getRandomAddressBookLocation($AddressBookLocationParameters); |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | |
| 19 | 19 | $randomLocation = $abLocation->getRandomAddressBookLocation($AddressBookLocationParameters); |
| 20 | 20 | |
| 21 | -if (assert(null != $randomLocation, 'Cannot get a randoma address book location')); |
|
| 21 | +if (assert(null!=$randomLocation, 'Cannot get a randoma address book location')); |
|
| 22 | 22 | |
| 23 | 23 | // Get the address book location by address_id |
| 24 | 24 | $addressID = $randomLocation['address_id']; |
@@ -21,19 +21,19 @@ discard block |
||
| 21 | 21 | $addresses = []; |
| 22 | 22 | |
| 23 | 23 | foreach ($json as $address) { |
| 24 | - $addresses[] = Address::fromArray($address); |
|
| 24 | + $addresses[] = Address::fromArray($address); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $parameters = RouteParameters::fromArray([ |
| 28 | - 'algorithm_type' => AlgorithmType::TSP, |
|
| 29 | - 'distance_unit' => DistanceUnit::MILES, |
|
| 30 | - 'device_type' => DeviceType::WEB, |
|
| 31 | - 'optimize' => OptimizationType::DISTANCE, |
|
| 32 | - 'travel_mode' => TravelMode::DRIVING, |
|
| 33 | - 'route_max_duration' => 86400, |
|
| 34 | - 'vehicle_capacity' => 1, |
|
| 35 | - 'vehicle_max_distance_mi' => 10000, |
|
| 36 | - 'rt' => true, |
|
| 28 | + 'algorithm_type' => AlgorithmType::TSP, |
|
| 29 | + 'distance_unit' => DistanceUnit::MILES, |
|
| 30 | + 'device_type' => DeviceType::WEB, |
|
| 31 | + 'optimize' => OptimizationType::DISTANCE, |
|
| 32 | + 'travel_mode' => TravelMode::DRIVING, |
|
| 33 | + 'route_max_duration' => 86400, |
|
| 34 | + 'vehicle_capacity' => 1, |
|
| 35 | + 'vehicle_max_distance_mi' => 10000, |
|
| 36 | + 'rt' => true, |
|
| 37 | 37 | ]); |
| 38 | 38 | |
| 39 | 39 | $optimizationParams = new OptimizationProblemParams(); |
@@ -43,5 +43,5 @@ discard block |
||
| 43 | 43 | $problems = OptimizationProblem::optimize($optimizationParams); |
| 44 | 44 | |
| 45 | 45 | foreach ($problems as $problem) { |
| 46 | - Route4Me::simplePrint($problem, true ); |
|
| 46 | + Route4Me::simplePrint($problem, true ); |
|
| 47 | 47 | } |
@@ -43,5 +43,5 @@ |
||
| 43 | 43 | $problems = OptimizationProblem::optimize($optimizationParams); |
| 44 | 44 | |
| 45 | 45 | foreach ($problems as $problem) { |
| 46 | - Route4Me::simplePrint($problem, true ); |
|
| 46 | + Route4Me::simplePrint($problem, true); |
|
| 47 | 47 | } |
@@ -23,20 +23,20 @@ discard block |
||
| 23 | 23 | $addresses = []; |
| 24 | 24 | |
| 25 | 25 | foreach ($json as $address) { |
| 26 | - $addresses[] = Address::fromArray($address); |
|
| 26 | + $addresses[] = Address::fromArray($address); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | $parameters = RouteParameters::fromArray([ |
| 30 | - 'algorithm_type' => AlgorithmType::TSP, |
|
| 31 | - 'distance_unit' => DistanceUnit::MILES, |
|
| 32 | - 'device_type' => DeviceType::WEB, |
|
| 33 | - 'optimize' => OptimizationType::DISTANCE, |
|
| 34 | - 'travel_mode' => TravelMode::DRIVING, |
|
| 35 | - 'route_max_duration' => 86400, |
|
| 36 | - 'vehicle_capacity' => 1, |
|
| 37 | - 'vehicle_max_distance_mi' => 10000, |
|
| 38 | - 'rt' => true, |
|
| 39 | - 'optimized_callback_url' => 'https://requestb.in/1o6cgge1', |
|
| 30 | + 'algorithm_type' => AlgorithmType::TSP, |
|
| 31 | + 'distance_unit' => DistanceUnit::MILES, |
|
| 32 | + 'device_type' => DeviceType::WEB, |
|
| 33 | + 'optimize' => OptimizationType::DISTANCE, |
|
| 34 | + 'travel_mode' => TravelMode::DRIVING, |
|
| 35 | + 'route_max_duration' => 86400, |
|
| 36 | + 'vehicle_capacity' => 1, |
|
| 37 | + 'vehicle_max_distance_mi' => 10000, |
|
| 38 | + 'rt' => true, |
|
| 39 | + 'optimized_callback_url' => 'https://requestb.in/1o6cgge1', |
|
| 40 | 40 | ]); |
| 41 | 41 | |
| 42 | 42 | $optimizationParams = new OptimizationProblemParams(); |
@@ -46,5 +46,5 @@ discard block |
||
| 46 | 46 | $problems = OptimizationProblem::optimize($optimizationParams); |
| 47 | 47 | |
| 48 | 48 | foreach ($problems as $problem) { |
| 49 | - Route4Me::simplePrint($problem, true); |
|
| 49 | + Route4Me::simplePrint($problem, true); |
|
| 50 | 50 | } |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | Route4Me::setApiKey(Constants::API_KEY); |
| 13 | 13 | |
| 14 | 14 | $AddressBookLocationParameters = AddressBookLocation::fromArray([ |
| 15 | - 'first_name' => 'Test FirstName '.strval(rand(10000, 99999)), |
|
| 16 | - 'address_1' => 'Test Address1 '.strval(rand(10000, 99999)), |
|
| 17 | - 'cached_lat' => 38.024654, |
|
| 18 | - 'cached_lng' => -77.338814, |
|
| 15 | + 'first_name' => 'Test FirstName '.strval(rand(10000, 99999)), |
|
| 16 | + 'address_1' => 'Test Address1 '.strval(rand(10000, 99999)), |
|
| 17 | + 'cached_lat' => 38.024654, |
|
| 18 | + 'cached_lng' => -77.338814, |
|
| 19 | 19 | ]); |
| 20 | 20 | |
| 21 | 21 | $abContacts = new AddressBookLocation(); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $address_id = -1; |
| 26 | 26 | |
| 27 | 27 | if (isset($createdContact['address_id'])) { |
| 28 | - $address_id = $createdContact['address_id']; |
|
| 28 | + $address_id = $createdContact['address_id']; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | assert($address_id != -1, 'Creating of Address Book Location was failed. Try again!.. <br>'); |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | $address_id = $createdContact['address_id']; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | -assert($address_id != -1, 'Creating of Address Book Location was failed. Try again!.. <br>'); |
|
| 31 | +assert($address_id!=-1, 'Creating of Address Book Location was failed. Try again!.. <br>'); |
|
| 32 | 32 | |
| 33 | 33 | echo 'Address Book Location with address_id = '.strval($address_id).' was successfully added<br>'; |
| 34 | 34 | |
@@ -20,18 +20,18 @@ |
||
| 20 | 20 | |
| 21 | 21 | $addresses = []; |
| 22 | 22 | foreach ($json as $address) { |
| 23 | - $addresses[] = Address::fromArray($address); |
|
| 23 | + $addresses[] = Address::fromArray($address); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | $parameters = RouteParameters::fromArray([ |
| 27 | - 'algorithm_type' => AlgorithmType::TSP, |
|
| 28 | - 'distance_unit' => DistanceUnit::MILES, |
|
| 29 | - 'device_type' => DeviceType::WEB, |
|
| 30 | - 'optimize' => OptimizationType::DISTANCE, |
|
| 31 | - 'travel_mode' => TravelMode::DRIVING, |
|
| 32 | - 'route_max_duration' => 86400, |
|
| 33 | - 'vehicle_capacity' => 1, |
|
| 34 | - 'vehicle_max_distance_mi' => 10000, |
|
| 27 | + 'algorithm_type' => AlgorithmType::TSP, |
|
| 28 | + 'distance_unit' => DistanceUnit::MILES, |
|
| 29 | + 'device_type' => DeviceType::WEB, |
|
| 30 | + 'optimize' => OptimizationType::DISTANCE, |
|
| 31 | + 'travel_mode' => TravelMode::DRIVING, |
|
| 32 | + 'route_max_duration' => 86400, |
|
| 33 | + 'vehicle_capacity' => 1, |
|
| 34 | + 'vehicle_max_distance_mi' => 10000, |
|
| 35 | 35 | ]); |
| 36 | 36 | |
| 37 | 37 | $optimizationParams = new OptimizationProblemParams(); |
@@ -40,4 +40,4 @@ |
||
| 40 | 40 | |
| 41 | 41 | $problem = OptimizationProblem::optimize($optimizationParams); |
| 42 | 42 | |
| 43 | -Route4Me::simplePrint((array) $problem, true); |
|
| 43 | +Route4Me::simplePrint((array)$problem, true); |
|
@@ -21,24 +21,24 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | $addresses = []; |
| 23 | 23 | foreach ($json as $address) { |
| 24 | - $addresses[] = Address::fromArray($address); |
|
| 24 | + $addresses[] = Address::fromArray($address); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $parameters = RouteParameters::fromArray([ |
| 28 | - 'algorithm_type' => Algorithmtype::CVRP_TW_SD, |
|
| 29 | - 'route_name' => 'Single Depot, Multiple Driver, No Time Window', |
|
| 30 | - 'route_date' => time() + 24 * 60 * 60, |
|
| 31 | - 'route_time' => 60 * 60 * 7, |
|
| 32 | - 'rt' => true, |
|
| 33 | - 'distance_unit' => DistanceUnit::MILES, |
|
| 34 | - 'device_type' => DeviceType::WEB, |
|
| 35 | - 'optimize' => OptimizationType::TIME, |
|
| 36 | - 'metric' => Metric::GEODESIC, |
|
| 37 | - 'route_max_duration' => 86400, |
|
| 38 | - 'travel_mode' => TravelMode::DRIVING, |
|
| 39 | - 'vehicle_capacity' => 20, |
|
| 40 | - 'vehicle_max_distance_mi' => 99999, |
|
| 41 | - 'parts' => 4, |
|
| 28 | + 'algorithm_type' => Algorithmtype::CVRP_TW_SD, |
|
| 29 | + 'route_name' => 'Single Depot, Multiple Driver, No Time Window', |
|
| 30 | + 'route_date' => time() + 24 * 60 * 60, |
|
| 31 | + 'route_time' => 60 * 60 * 7, |
|
| 32 | + 'rt' => true, |
|
| 33 | + 'distance_unit' => DistanceUnit::MILES, |
|
| 34 | + 'device_type' => DeviceType::WEB, |
|
| 35 | + 'optimize' => OptimizationType::TIME, |
|
| 36 | + 'metric' => Metric::GEODESIC, |
|
| 37 | + 'route_max_duration' => 86400, |
|
| 38 | + 'travel_mode' => TravelMode::DRIVING, |
|
| 39 | + 'vehicle_capacity' => 20, |
|
| 40 | + 'vehicle_max_distance_mi' => 99999, |
|
| 41 | + 'parts' => 4, |
|
| 42 | 42 | ]); |
| 43 | 43 | |
| 44 | 44 | $optimizationParams = new OptimizationProblemParams(); |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | $problem = OptimizationProblem::optimize($optimizationParams); |
| 49 | 49 | |
| 50 | 50 | foreach ((array) $problem as $key => $value) { |
| 51 | - if (is_string($value)) { |
|
| 52 | - echo $key.' --> '.$value.'<br>'; |
|
| 53 | - } else { |
|
| 54 | - echo "************ $key ************* <br>"; |
|
| 55 | - Route4Me::simplePrint((array) $value, true); |
|
| 56 | - echo '******************************* <br>'; |
|
| 57 | - } |
|
| 51 | + if (is_string($value)) { |
|
| 52 | + echo $key.' --> '.$value.'<br>'; |
|
| 53 | + } else { |
|
| 54 | + echo "************ $key ************* <br>"; |
|
| 55 | + Route4Me::simplePrint((array) $value, true); |
|
| 56 | + echo '******************************* <br>'; |
|
| 57 | + } |
|
| 58 | 58 | } |
@@ -47,12 +47,12 @@ |
||
| 47 | 47 | |
| 48 | 48 | $problem = OptimizationProblem::optimize($optimizationParams); |
| 49 | 49 | |
| 50 | -foreach ((array) $problem as $key => $value) { |
|
| 50 | +foreach ((array)$problem as $key => $value) { |
|
| 51 | 51 | if (is_string($value)) { |
| 52 | 52 | echo $key.' --> '.$value.'<br>'; |
| 53 | 53 | } else { |
| 54 | 54 | echo "************ $key ************* <br>"; |
| 55 | - Route4Me::simplePrint((array) $value, true); |
|
| 55 | + Route4Me::simplePrint((array)$value, true); |
|
| 56 | 56 | echo '******************************* <br>'; |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -18,11 +18,11 @@ |
||
| 18 | 18 | $randomVendorID = $vendors->GetRandomVendorID(0, 5); |
| 19 | 19 | |
| 20 | 20 | $vendorParameters = TelematicsVendor::fromArray([ |
| 21 | - 'vendor_id' => $randomVendorID, |
|
| 21 | + 'vendor_id' => $randomVendorID, |
|
| 22 | 22 | ]); |
| 23 | 23 | |
| 24 | 24 | $vendor = new TelematicsVendor(); |
| 25 | 25 | $vendorResult = $vendor->GetTelematicsVendors($vendorParameters); |
| 26 | 26 | |
| 27 | 27 | Route4Me::simplePrint($vendorResult); |
| 28 | - echo '<br>'; |
|
| 28 | + echo '<br>'; |
|
@@ -20,6 +20,6 @@ |
||
| 20 | 20 | $vendorsResults = $vendors->GetTelematicsVendors($vendorsParameters); |
| 21 | 21 | |
| 22 | 22 | foreach ($vendorsResults['vendors'] as $result) { |
| 23 | - Route4Me::simplePrint($result); |
|
| 24 | - echo '<br>'; |
|
| 23 | + Route4Me::simplePrint($result); |
|
| 24 | + echo '<br>'; |
|
| 25 | 25 | } |
@@ -14,18 +14,18 @@ |
||
| 14 | 14 | Route4Me::setApiKey(Constants::API_KEY); |
| 15 | 15 | |
| 16 | 16 | $vendorsParameters = TelematicsVendor::fromArray([ |
| 17 | - //"country" => "GB", // uncomment this line for searching by Country |
|
| 18 | - 'is_integrated' => 1, |
|
| 19 | - //"feature" => "satellite", // uncomment this line for searching by Feature |
|
| 20 | - 'search' => 'Fleet', |
|
| 21 | - 'page' => 1, |
|
| 22 | - 'per_page' => 5, |
|
| 17 | + //"country" => "GB", // uncomment this line for searching by Country |
|
| 18 | + 'is_integrated' => 1, |
|
| 19 | + //"feature" => "satellite", // uncomment this line for searching by Feature |
|
| 20 | + 'search' => 'Fleet', |
|
| 21 | + 'page' => 1, |
|
| 22 | + 'per_page' => 5, |
|
| 23 | 23 | ]); |
| 24 | 24 | |
| 25 | 25 | $vendors = new TelematicsVendor(); |
| 26 | 26 | $vendorsResults = $vendors->GetTelematicsVendors($vendorsParameters); |
| 27 | 27 | |
| 28 | 28 | foreach ($vendorsResults['vendors'] as $result) { |
| 29 | - Route4Me::simplePrint($result); |
|
| 30 | - echo '<br>'; |
|
| 29 | + Route4Me::simplePrint($result); |
|
| 30 | + echo '<br>'; |
|
| 31 | 31 | } |