@@ -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 | $abLocation = new AddressBookLocation(); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | assert(isset($abcResult['address_id']), 'Cannot create an address book location. <br><br>'); |
| 28 | 28 | |
| 29 | 29 | if (isset($abcResult['address_id'])) { |
| 30 | - $address_id = $abcResult['address_id']; |
|
| 30 | + $address_id = $abcResult['address_id']; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | assert($address_id != -1, 'Cannot create an address book location. <br><br>'); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $address_id = $abcResult['address_id']; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | -assert($address_id != -1, 'Cannot create an address book location. <br><br>'); |
|
| 33 | +assert($address_id!=-1, 'Cannot create an address book location. <br><br>'); |
|
| 34 | 34 | |
| 35 | 35 | echo 'Address Book Location with <b>address_id = '.strval($address_id).'</b> and <b>first_name = '.$abcResult['first_name'].'</b> was successfully added<br>'; |
| 36 | 36 | |
@@ -40,6 +40,6 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | assert(isset($abcResult['first_name']), 'Cannot update the address book location. <br><br>'); |
| 42 | 42 | |
| 43 | -assert('Test First Name Updated' == $abcResult['first_name'], 'Cannot update the address book location. <br><br>'); |
|
| 43 | +assert('Test First Name Updated'==$abcResult['first_name'], 'Cannot update the address book location. <br><br>'); |
|
| 44 | 44 | |
| 45 | 45 | echo 'The field <b>first_name</b> in the address book location <b>'.$address_id.'</b> was update to <b>Test First Name Updated</b> successfuly <br>'; |
@@ -18,14 +18,14 @@ |
||
| 18 | 18 | |
| 19 | 19 | $territoryParams['type'] = TerritoryTypes::CIRCLE; |
| 20 | 20 | $territoryParams['data'] = [ |
| 21 | - '37.569752822786455,-77.47833251953125', |
|
| 22 | - '5000', |
|
| 21 | + '37.569752822786455,-77.47833251953125', |
|
| 22 | + '5000', |
|
| 23 | 23 | ]; |
| 24 | 24 | |
| 25 | 25 | $avoidanceZoneParameters = AvoidanceZone::fromArray([ |
| 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 | $avoidanceZone = new AvoidanceZone(); |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | $avoidanceZone = new AvoidanceZone(); |
| 32 | 32 | |
| 33 | -$result = (array) $avoidanceZone->addAvoidanceZone($avoidanceZoneParameters); |
|
| 33 | +$result = (array)$avoidanceZone->addAvoidanceZone($avoidanceZoneParameters); |
|
| 34 | 34 | |
| 35 | 35 | assert(isset($result), 'Failed to create new Avoidance Zone'); |
| 36 | 36 | |
@@ -15,6 +15,6 @@ |
||
| 15 | 15 | $avZones = $avoidanceZone->getAvoidanceZones($queryParameters); |
| 16 | 16 | |
| 17 | 17 | foreach ($avZones as $avZone) { |
| 18 | - Route4Me::simplePrint($avZone); |
|
| 19 | - echo '<br>'; |
|
| 18 | + Route4Me::simplePrint($avZone); |
|
| 19 | + echo '<br>'; |
|
| 20 | 20 | } |
@@ -16,14 +16,14 @@ |
||
| 16 | 16 | |
| 17 | 17 | $territoryParams['type'] = TerritoryTypes::CIRCLE; |
| 18 | 18 | $territoryParams['data'] = [ |
| 19 | - '37.569752822786455,-77.47833251953125', |
|
| 20 | - '5000', |
|
| 19 | + '37.569752822786455,-77.47833251953125', |
|
| 20 | + '5000', |
|
| 21 | 21 | ]; |
| 22 | 22 | |
| 23 | 23 | $AvoidanceZoneParameters = AvoidanceZone::fromArray([ |
| 24 | - 'territory_name' => 'Test Circle Avoidance Zone '.strval(rand(10000, 99999)), |
|
| 25 | - 'territory_color' => 'ff7700', |
|
| 26 | - 'territory' => $territoryParams, |
|
| 24 | + 'territory_name' => 'Test Circle Avoidance Zone '.strval(rand(10000, 99999)), |
|
| 25 | + 'territory_color' => 'ff7700', |
|
| 26 | + 'territory' => $territoryParams, |
|
| 27 | 27 | ]); |
| 28 | 28 | |
| 29 | 29 | $avoidanceZone = new AvoidanceZone(); |
@@ -16,14 +16,14 @@ |
||
| 16 | 16 | |
| 17 | 17 | $territoryParams['type'] = TerritoryTypes::RECT; |
| 18 | 18 | $territoryParams['data'] = [ |
| 19 | - '43.51668853502909,-109.3798828125', |
|
| 20 | - '46.98025235521883,-101.865234375', |
|
| 19 | + '43.51668853502909,-109.3798828125', |
|
| 20 | + '46.98025235521883,-101.865234375', |
|
| 21 | 21 | ]; |
| 22 | 22 | |
| 23 | 23 | $AvoidanceZoneParameters = AvoidanceZone::fromArray([ |
| 24 | - 'territory_name' => 'Test Rectangular Avoidance Zone '.strval(rand(10000, 99999)), |
|
| 25 | - 'territory_color' => 'ff7700', |
|
| 26 | - 'territory' => $territoryParams, |
|
| 24 | + 'territory_name' => 'Test Rectangular Avoidance Zone '.strval(rand(10000, 99999)), |
|
| 25 | + 'territory_color' => 'ff7700', |
|
| 26 | + 'territory' => $territoryParams, |
|
| 27 | 27 | ]); |
| 28 | 28 | |
| 29 | 29 | $avoidanceZone = new AvoidanceZone(); |
@@ -16,21 +16,21 @@ |
||
| 16 | 16 | |
| 17 | 17 | $territoryParams['type'] = TerritoryTypes::POLY; |
| 18 | 18 | $territoryParams['data'] = [ |
| 19 | - '37.769752822786455,-77.67833251953125', |
|
| 20 | - '37.75886716305343,-77.68974800109863', |
|
| 21 | - '37.74763966054455,-77.6917221069336', |
|
| 22 | - '37.74655084306813,-77.68863220214844', |
|
| 23 | - '37.7502255383101,-77.68125076293945', |
|
| 24 | - '37.74797991274437,-77.67498512268066', |
|
| 25 | - '37.73327960206065,-77.6411678314209', |
|
| 26 | - '37.74430510679532,-77.63172645568848', |
|
| 27 | - '37.76641925847049,-77.66846199035645', |
|
| 19 | + '37.769752822786455,-77.67833251953125', |
|
| 20 | + '37.75886716305343,-77.68974800109863', |
|
| 21 | + '37.74763966054455,-77.6917221069336', |
|
| 22 | + '37.74655084306813,-77.68863220214844', |
|
| 23 | + '37.7502255383101,-77.68125076293945', |
|
| 24 | + '37.74797991274437,-77.67498512268066', |
|
| 25 | + '37.73327960206065,-77.6411678314209', |
|
| 26 | + '37.74430510679532,-77.63172645568848', |
|
| 27 | + '37.76641925847049,-77.66846199035645', |
|
| 28 | 28 | ]; |
| 29 | 29 | |
| 30 | 30 | $AvoidanceZoneParameters = AvoidanceZone::fromArray([ |
| 31 | - 'territory_name' => 'Test Polygonal Avoidance Zone '.strval(rand(10000, 99999)), |
|
| 32 | - 'territory_color' => 'ff7700', |
|
| 33 | - 'territory' => $territoryParams, |
|
| 31 | + 'territory_name' => 'Test Polygonal Avoidance Zone '.strval(rand(10000, 99999)), |
|
| 32 | + 'territory_color' => 'ff7700', |
|
| 33 | + 'territory' => $territoryParams, |
|
| 34 | 34 | ]); |
| 35 | 35 | |
| 36 | 36 | $avoidanceZone = new AvoidanceZone(); |
@@ -18,14 +18,14 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | $territoryParams['type'] = TerritoryTypes::CIRCLE; |
| 20 | 20 | $territoryParams['data'] = [ |
| 21 | - '37.569752822786455,-77.47833251953125', |
|
| 22 | - '5000', |
|
| 21 | + '37.569752822786455,-77.47833251953125', |
|
| 22 | + '5000', |
|
| 23 | 23 | ]; |
| 24 | 24 | |
| 25 | 25 | $avoidanceZoneParameters = AvoidanceZone::fromArray([ |
| 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 | $avoidanceZone = new AvoidanceZone(); |
@@ -41,15 +41,15 @@ discard block |
||
| 41 | 41 | $territory = new Territory(); |
| 42 | 42 | $territory->type = TerritoryTypes::RECT; |
| 43 | 43 | $territory->data = [ |
| 44 | - '37.869752822786455,-77.49833251953125', |
|
| 45 | - '5000', |
|
| 44 | + '37.869752822786455,-77.49833251953125', |
|
| 45 | + '5000', |
|
| 46 | 46 | ]; |
| 47 | 47 | |
| 48 | 48 | $avoidanceZoneParameters = [ |
| 49 | - 'territory_id' => $territory_id, |
|
| 50 | - 'territory_name' => 'Test Territory Updated', |
|
| 51 | - 'territory_color' => 'ff5500', |
|
| 52 | - 'territory' => $territory, |
|
| 49 | + 'territory_id' => $territory_id, |
|
| 50 | + 'territory_name' => 'Test Territory Updated', |
|
| 51 | + 'territory_color' => 'ff5500', |
|
| 52 | + 'territory' => $territory, |
|
| 53 | 53 | ]; |
| 54 | 54 | |
| 55 | 55 | $result1 = $avoidanceZone->updateAvoidanceZone($avoidanceZoneParameters); |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | $avoidanceZone = new AvoidanceZone(); |
| 32 | 32 | |
| 33 | -$result = (array) $avoidanceZone->addAvoidanceZone($avoidanceZoneParameters); |
|
| 33 | +$result = (array)$avoidanceZone->addAvoidanceZone($avoidanceZoneParameters); |
|
| 34 | 34 | |
| 35 | 35 | assert(isset($result), 'Failed to create new Avoidance Zone'); |
| 36 | 36 | |
@@ -18,14 +18,14 @@ |
||
| 18 | 18 | |
| 19 | 19 | $territoryParams['type'] = TerritoryTypes::CIRCLE; |
| 20 | 20 | $territoryParams['data'] = [ |
| 21 | - '37.569752822786455,-77.47833251953125', |
|
| 22 | - '5000', |
|
| 21 | + '37.569752822786455,-77.47833251953125', |
|
| 22 | + '5000', |
|
| 23 | 23 | ]; |
| 24 | 24 | |
| 25 | 25 | $avoidanceZoneParameters = AvoidanceZone::fromArray([ |
| 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 | $avoidanceZone = new AvoidanceZone(); |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | $avoidanceZone = new AvoidanceZone(); |
| 32 | 32 | |
| 33 | -$result = (array) $avoidanceZone->addAvoidanceZone($avoidanceZoneParameters); |
|
| 33 | +$result = (array)$avoidanceZone->addAvoidanceZone($avoidanceZoneParameters); |
|
| 34 | 34 | |
| 35 | 35 | assert(isset($result), 'Failed to create new Avoidance Zone'); |
| 36 | 36 | |
@@ -21,20 +21,20 @@ |
||
| 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 | - 'distance_unit' => DistanceUnit::MILES, |
|
| 30 | - 'device_type' => DeviceType::WEB, |
|
| 31 | - 'optimize' => OptimizationType::DISTANCE, |
|
| 32 | - 'metric' => Metric::GEODESIC, |
|
| 33 | - 'route_max_duration' => 86400 * 2, |
|
| 34 | - 'travel_mode' => TravelMode::DRIVING, |
|
| 35 | - 'vehicle_capacity' => 50, |
|
| 36 | - 'vehicle_max_distance_mi' => 10000, |
|
| 37 | - 'parts' => 50, |
|
| 28 | + 'algorithm_type' => AlgorithmType::CVRP_TW_SD, |
|
| 29 | + 'distance_unit' => DistanceUnit::MILES, |
|
| 30 | + 'device_type' => DeviceType::WEB, |
|
| 31 | + 'optimize' => OptimizationType::DISTANCE, |
|
| 32 | + 'metric' => Metric::GEODESIC, |
|
| 33 | + 'route_max_duration' => 86400 * 2, |
|
| 34 | + 'travel_mode' => TravelMode::DRIVING, |
|
| 35 | + 'vehicle_capacity' => 50, |
|
| 36 | + 'vehicle_max_distance_mi' => 10000, |
|
| 37 | + 'parts' => 50, |
|
| 38 | 38 | ]); |
| 39 | 39 | |
| 40 | 40 | $optimizationParams = new OptimizationProblemParams(); |
@@ -43,4 +43,4 @@ |
||
| 43 | 43 | |
| 44 | 44 | $problem = OptimizationProblem::optimize($optimizationParams); |
| 45 | 45 | |
| 46 | -Route4Me::simplePrint((array) $problem, true); |
|
| 46 | +Route4Me::simplePrint((array)$problem, true); |
|