@@ -26,24 +26,24 @@ 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" => "Single Depot, Multiple Driver, No 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, |
|
| 43 | - "travel_mode" => TravelMode::DRIVING, |
|
| 44 | - "vehicle_capacity" => 20, |
|
| 45 | - "vehicle_max_distance_mi" => 99999, |
|
| 46 | - "parts" => 4 |
|
| 33 | + "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
|
| 34 | + "route_name" => "Single Depot, Multiple Driver, No 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, |
|
| 43 | + "travel_mode" => TravelMode::DRIVING, |
|
| 44 | + "vehicle_capacity" => 20, |
|
| 45 | + "vehicle_max_distance_mi" => 99999, |
|
| 46 | + "parts" => 4 |
|
| 47 | 47 | )); |
| 48 | 48 | |
| 49 | 49 | $optimizationParams = new OptimizationProblemParams; |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | $problem = OptimizationProblem::optimize($optimizationParams); |
| 54 | 54 | |
| 55 | 55 | foreach ((array)$problem as $key => $value) { |
| 56 | - if (is_string($value)) { |
|
| 57 | - echo $key." --> ".$value."<br>"; |
|
| 58 | - } else { |
|
| 59 | - echo "************ $key ************* <br>"; |
|
| 60 | - Route4Me::simplePrint((array)$value, true); |
|
| 61 | - echo "******************************* <br>"; |
|
| 62 | - } |
|
| 56 | + if (is_string($value)) { |
|
| 57 | + echo $key." --> ".$value."<br>"; |
|
| 58 | + } else { |
|
| 59 | + echo "************ $key ************* <br>"; |
|
| 60 | + Route4Me::simplePrint((array)$value, true); |
|
| 61 | + echo "******************************* <br>"; |
|
| 62 | + } |
|
| 63 | 63 | } |
| 64 | 64 | |
@@ -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,14 +25,14 @@ discard block |
||
| 25 | 25 | $json = json_decode(file_get_contents('./addresses.json'), true); |
| 26 | 26 | |
| 27 | 27 | $addresses = array(); |
| 28 | -foreach($json as $address) { |
|
| 28 | +foreach ($json as $address) { |
|
| 29 | 29 | $addresses[] = Address::fromArray($address); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $parameters = RouteParameters::fromArray(array( |
| 33 | 33 | "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
| 34 | 34 | "route_name" => "Single Depot, Multiple Driver, No Time Window", |
| 35 | - "route_date" => time() + 24*60*60, |
|
| 35 | + "route_date" => time() + 24 * 60 * 60, |
|
| 36 | 36 | "route_time" => 60 * 60 * 7, |
| 37 | 37 | "rt" => TRUE, |
| 38 | 38 | "distance_unit" => DistanceUnit::MILES, |
@@ -27,19 +27,19 @@ discard block |
||
| 27 | 27 | $addresses = array(); |
| 28 | 28 | |
| 29 | 29 | foreach($json as $address) { |
| 30 | - $addresses[] = Address::fromArray($address); |
|
| 30 | + $addresses[] = Address::fromArray($address); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $parameters = RouteParameters::fromArray(array( |
| 34 | - "algorithm_type" => AlgorithmType::TSP, |
|
| 35 | - "distance_unit" => DistanceUnit::MILES, |
|
| 36 | - "device_type" => DeviceType::WEB, |
|
| 37 | - "optimize" => OptimizationType::DISTANCE, |
|
| 38 | - "travel_mode" => TravelMode::DRIVING, |
|
| 39 | - "route_max_duration" => 86400, |
|
| 40 | - "vehicle_capacity" => 1, |
|
| 41 | - "vehicle_max_distance_mi" => 10000, |
|
| 42 | - "rt" => true |
|
| 34 | + "algorithm_type" => AlgorithmType::TSP, |
|
| 35 | + "distance_unit" => DistanceUnit::MILES, |
|
| 36 | + "device_type" => DeviceType::WEB, |
|
| 37 | + "optimize" => OptimizationType::DISTANCE, |
|
| 38 | + "travel_mode" => TravelMode::DRIVING, |
|
| 39 | + "route_max_duration" => 86400, |
|
| 40 | + "vehicle_capacity" => 1, |
|
| 41 | + "vehicle_max_distance_mi" => 10000, |
|
| 42 | + "rt" => true |
|
| 43 | 43 | )); |
| 44 | 44 | |
| 45 | 45 | $optimizationParams = new OptimizationProblemParams; |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | $problems = OptimizationProblem::optimize($optimizationParams); |
| 50 | 50 | |
| 51 | 51 | foreach ($problems as $problem) { |
| 52 | - if (is_array($problem) || is_object($problem)) { |
|
| 53 | - foreach ($problem as $key => $value) { |
|
| 54 | - if (!is_object($value)) { |
|
| 55 | - echo $key." --> ".$value."<br>"; |
|
| 56 | - } |
|
| 57 | - } |
|
| 58 | - } |
|
| 52 | + if (is_array($problem) || is_object($problem)) { |
|
| 53 | + foreach ($problem as $key => $value) { |
|
| 54 | + if (!is_object($value)) { |
|
| 55 | + echo $key." --> ".$value."<br>"; |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | 59 | } |
@@ -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; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | $addresses = array(); |
| 28 | 28 | |
| 29 | -foreach($json as $address) { |
|
| 29 | +foreach ($json as $address) { |
|
| 30 | 30 | $addresses[] = Address::fromArray($address); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -29,20 +29,20 @@ discard block |
||
| 29 | 29 | $addresses = array(); |
| 30 | 30 | |
| 31 | 31 | foreach($json as $address) { |
| 32 | - $addresses[] = Address::fromArray($address); |
|
| 32 | + $addresses[] = Address::fromArray($address); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $parameters = RouteParameters::fromArray(array( |
| 36 | - "algorithm_type" => AlgorithmType::TSP, |
|
| 37 | - "distance_unit" => DistanceUnit::MILES, |
|
| 38 | - "device_type" => DeviceType::WEB, |
|
| 39 | - "optimize" => OptimizationType::DISTANCE, |
|
| 40 | - "travel_mode" => TravelMode::DRIVING, |
|
| 41 | - "route_max_duration" => 86400, |
|
| 42 | - "vehicle_capacity" => 1, |
|
| 43 | - "vehicle_max_distance_mi" => 10000, |
|
| 44 | - "rt" => true, |
|
| 45 | - "optimized_callback_url" => "https://requestb.in/1o6cgge1" |
|
| 36 | + "algorithm_type" => AlgorithmType::TSP, |
|
| 37 | + "distance_unit" => DistanceUnit::MILES, |
|
| 38 | + "device_type" => DeviceType::WEB, |
|
| 39 | + "optimize" => OptimizationType::DISTANCE, |
|
| 40 | + "travel_mode" => TravelMode::DRIVING, |
|
| 41 | + "route_max_duration" => 86400, |
|
| 42 | + "vehicle_capacity" => 1, |
|
| 43 | + "vehicle_max_distance_mi" => 10000, |
|
| 44 | + "rt" => true, |
|
| 45 | + "optimized_callback_url" => "https://requestb.in/1o6cgge1" |
|
| 46 | 46 | )); |
| 47 | 47 | |
| 48 | 48 | $optimizationParams = new OptimizationProblemParams; |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | $problems = OptimizationProblem::optimize($optimizationParams); |
| 53 | 53 | |
| 54 | 54 | foreach ($problems as $problem) { |
| 55 | - if (is_array($problem) || is_object($problem)) { |
|
| 56 | - foreach ($problem as $key => $value) { |
|
| 57 | - if (!is_object($value)) { |
|
| 58 | - echo $key." --> ".$value."<br>"; |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - } |
|
| 55 | + if (is_array($problem) || is_object($problem)) { |
|
| 56 | + foreach ($problem as $key => $value) { |
|
| 57 | + if (!is_object($value)) { |
|
| 58 | + echo $key." --> ".$value."<br>"; |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | 62 | } |
@@ -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; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | $addresses = array(); |
| 28 | 28 | |
| 29 | -foreach($json as $address) { |
|
| 29 | +foreach ($json as $address) { |
|
| 30 | 30 | $addresses[] = Address::fromArray($address); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -13,9 +13,9 @@ |
||
| 13 | 13 | Route4Me::setApiKey('11111111111111111111111111111111'); |
| 14 | 14 | |
| 15 | 15 | $recordParameters=Member::fromArray(array( |
| 16 | - 'device_id' => '546546516', |
|
| 17 | - 'device_type' => 'IPAD', |
|
| 18 | - 'format' => 'json', |
|
| 16 | + 'device_id' => '546546516', |
|
| 17 | + 'device_type' => 'IPAD', |
|
| 18 | + 'format' => 'json', |
|
| 19 | 19 | )); |
| 20 | 20 | |
| 21 | 21 | $member = new Member(); |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root = realpath(dirname(__FILE__) . '/../../'); |
|
| 5 | -require $root . '/vendor/autoload.php'; |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | +require $root.'/vendor/autoload.php'; |
|
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
| 8 | 8 | use Route4Me\Member; |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | // Set the API key in the Route4Me class |
| 13 | 13 | Route4Me::setApiKey('11111111111111111111111111111111'); |
| 14 | 14 | |
| 15 | -$recordParameters=Member::fromArray(array( |
|
| 15 | +$recordParameters = Member::fromArray(array( |
|
| 16 | 16 | 'device_id' => '546546516', |
| 17 | 17 | 'device_type' => 'IPAD', |
| 18 | 18 | 'format' => 'json', |
@@ -13,14 +13,14 @@ |
||
| 13 | 13 | Route4Me::setApiKey('11111111111111111111111111111111'); |
| 14 | 14 | |
| 15 | 15 | $recordParameters=Member::fromArray(array( |
| 16 | - 'member_id' => 777777, |
|
| 17 | - 'session_guid' => '454563', |
|
| 18 | - 'device_id' => '54564', |
|
| 19 | - 'device_type' =>'ipad', |
|
| 20 | - 'subscription_name' =>'IPAD_MONTHLY', |
|
| 21 | - 'token' =>'4/P7q7W91a-oMsCeLvIaQm6bTrgtp7', |
|
| 22 | - 'payload' =>'APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx', |
|
| 23 | - 'format' =>'json' |
|
| 16 | + 'member_id' => 777777, |
|
| 17 | + 'session_guid' => '454563', |
|
| 18 | + 'device_id' => '54564', |
|
| 19 | + 'device_type' =>'ipad', |
|
| 20 | + 'subscription_name' =>'IPAD_MONTHLY', |
|
| 21 | + 'token' =>'4/P7q7W91a-oMsCeLvIaQm6bTrgtp7', |
|
| 22 | + 'payload' =>'APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx', |
|
| 23 | + 'format' =>'json' |
|
| 24 | 24 | )); |
| 25 | 25 | |
| 26 | 26 | $member = new Member(); |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root = realpath(dirname(__FILE__) . '/../../'); |
|
| 5 | -require $root . '/vendor/autoload.php'; |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | +require $root.'/vendor/autoload.php'; |
|
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
| 8 | 8 | use Route4Me\Member; |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | // Set the API key in the Route4Me class |
| 13 | 13 | Route4Me::setApiKey('11111111111111111111111111111111'); |
| 14 | 14 | |
| 15 | -$recordParameters=Member::fromArray(array( |
|
| 15 | +$recordParameters = Member::fromArray(array( |
|
| 16 | 16 | 'member_id' => 777777, |
| 17 | 17 | 'session_guid' => '454563', |
| 18 | 18 | 'device_id' => '54564', |
@@ -24,8 +24,8 @@ |
||
| 24 | 24 | |
| 25 | 25 | // Update member |
| 26 | 26 | $params = Member::fromArray(array ( |
| 27 | - "member_id" => $randomMemberID, |
|
| 28 | - "member_phone" => "555-777-888" |
|
| 27 | + "member_id" => $randomMemberID, |
|
| 28 | + "member_phone" => "555-777-888" |
|
| 29 | 29 | )); |
| 30 | 30 | |
| 31 | 31 | $response = $member->updateMember($params); |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | assert(!is_null($randomMemberID), "There is no member of the type SUB_ACCOUNT_DRIVER in the user's account"); |
| 24 | 24 | |
| 25 | 25 | // Update member |
| 26 | -$params = Member::fromArray(array ( |
|
| 26 | +$params = Member::fromArray(array( |
|
| 27 | 27 | "member_id" => $randomMemberID, |
| 28 | 28 | "member_phone" => "555-777-888" |
| 29 | 29 | )); |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | Route4Me::setApiKey('11111111111111111111111111111111'); |
| 14 | 14 | |
| 15 | 15 | $AdressBookLocationParameters = AddressBookLocation::fromArray(array( |
| 16 | - "first_name" => "Test FirstName ".strval(rand(10000,99999)), |
|
| 17 | - "address_1" => "Test Address1 ".strval(rand(10000,99999)), |
|
| 18 | - "cached_lat" => 38.024654, |
|
| 19 | - "cached_lng" => -77.338814 |
|
| 16 | + "first_name" => "Test FirstName ".strval(rand(10000,99999)), |
|
| 17 | + "address_1" => "Test Address1 ".strval(rand(10000,99999)), |
|
| 18 | + "cached_lat" => 38.024654, |
|
| 19 | + "cached_lng" => -77.338814 |
|
| 20 | 20 | )); |
| 21 | 21 | |
| 22 | 22 | $abLocation = new AddressBookLocation(); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | assert(isset($abcResult['address_id']), "Cannot create an address book location. <br><br>"); |
| 29 | 29 | |
| 30 | 30 | if (isset($abcResult["address_id"])) { |
| 31 | - $address_id = $abcResult["address_id"]; |
|
| 31 | + $address_id = $abcResult["address_id"]; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | assert($address_id != -1, "Cannot create an address book location. <br><br>"); |
@@ -13,8 +13,8 @@ discard block |
||
| 13 | 13 | Route4Me::setApiKey('11111111111111111111111111111111'); |
| 14 | 14 | |
| 15 | 15 | $AdressBookLocationParameters = AddressBookLocation::fromArray(array( |
| 16 | - "first_name" => "Test FirstName ".strval(rand(10000,99999)), |
|
| 17 | - "address_1" => "Test Address1 ".strval(rand(10000,99999)), |
|
| 16 | + "first_name" => "Test FirstName ".strval(rand(10000, 99999)), |
|
| 17 | + "address_1" => "Test Address1 ".strval(rand(10000, 99999)), |
|
| 18 | 18 | "cached_lat" => 38.024654, |
| 19 | 19 | "cached_lng" => -77.338814 |
| 20 | 20 | )); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $address_id = $abcResult["address_id"]; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | -assert($address_id != -1, "Cannot create an address book location. <br><br>"); |
|
| 34 | +assert($address_id!=-1, "Cannot create an address book location. <br><br>"); |
|
| 35 | 35 | |
| 36 | 36 | echo "Address Book Location with <b>address_id = ".strval($address_id)."</b> and <b>first_name = ".$abcResult['first_name']."</b> was successfully added<br>"; |
| 37 | 37 | |
@@ -41,6 +41,6 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | assert(isset($abcResult['first_name']), "Cannot update the address book location. <br><br>"); |
| 43 | 43 | |
| 44 | -assert($abcResult['first_name'] == 'Test Firstname Updated', "Cannot update the address book location. <br><br>"); |
|
| 44 | +assert($abcResult['first_name']=='Test Firstname Updated', "Cannot update the address book location. <br><br>"); |
|
| 45 | 45 | |
| 46 | 46 | echo "The field <b>first_name</b> in the address book location <b>".$address_id."</b> was update to <b>Test Firstname Updated</b> successfuly <br>"; |
@@ -13,8 +13,8 @@ discard block |
||
| 13 | 13 | // Example refers to getting the address book locations |
| 14 | 14 | |
| 15 | 15 | $AdressBookLocationParameters = array( |
| 16 | - "limit" => 30, |
|
| 17 | - "offset" => 0 |
|
| 16 | + "limit" => 30, |
|
| 17 | + "offset" => 0 |
|
| 18 | 18 | ); |
| 19 | 19 | |
| 20 | 20 | $abContacts = new AddressBookLocation(); |
@@ -25,5 +25,5 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | foreach ($results as $result) { |
| 27 | 27 | Route4Me::simplePrint($result); |
| 28 | - echo "<br>"; |
|
| 28 | + echo "<br>"; |
|
| 29 | 29 | } |
@@ -31,8 +31,8 @@ |
||
| 31 | 31 | $route->parameters = new \stdClass(); |
| 32 | 32 | |
| 33 | 33 | $route->parameters->custom_fields = array( |
| 34 | - "animal" => "tiger", |
|
| 35 | - "bird" => "canary" |
|
| 34 | + "animal" => "tiger", |
|
| 35 | + "bird" => "canary" |
|
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | 38 | $route->httpheaders = 'Content-type: application/json'; |