@@ -17,9 +17,9 @@ |
||
| 17 | 17 | $route_id = $route->getRandomRouteId(0, 10); |
| 18 | 18 | |
| 19 | 19 | $postParameters = ActivityParameters::fromArray(array( |
| 20 | - "activity_type" => "user_message", |
|
| 21 | - "activity_message" => "Hello - php!", |
|
| 22 | - "route_id" => $route_id |
|
| 20 | + "activity_type" => "user_message", |
|
| 21 | + "activity_message" => "Hello - php!", |
|
| 22 | + "route_id" => $route_id |
|
| 23 | 23 | )); |
| 24 | 24 | |
| 25 | 25 | $activities = new ActivityParameters(); |
@@ -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,10 +26,10 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | $results = $activities->sendUserMessage($postParameters); |
| 28 | 28 | |
| 29 | -$msg = isset($results["status"]) != null |
|
| 29 | +$msg = isset($results["status"])!=null |
|
| 30 | 30 | ? ($results["status"]==1 ? "The user message was sent to the route " : "he user message could not sent to the route ") |
| 31 | 31 | : "The user message could not sent to the route "; |
| 32 | 32 | |
| 33 | -$msg.=" with route_id=".$route_id; |
|
| 33 | +$msg .= " with route_id=".$route_id; |
|
| 34 | 34 | |
| 35 | 35 | echo "<br> $msg <br>"; |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | assert(!is_null($routeId), "can't retrieve random route_id"); |
| 21 | 21 | |
| 22 | 22 | $activityParameters = ActivityParameters::fromArray(array( |
| 23 | - "route_id" => $routeId, |
|
| 24 | - "team" => "true" |
|
| 23 | + "route_id" => $routeId, |
|
| 24 | + "team" => "true" |
|
| 25 | 25 | )); |
| 26 | 26 | |
| 27 | 27 | $activities = new ActivityParameters(); |
@@ -30,5 +30,5 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | foreach ($results as $result) { |
| 32 | 32 | Route4Me::simplePrint($result); |
| 33 | - echo "<br>"; |
|
| 33 | + echo "<br>"; |
|
| 34 | 34 | } |
@@ -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\Route; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | $activities = new ActivityParameters(); |
| 28 | 28 | $actresults = $activities->getActivities($activityParameters); |
| 29 | -$results = $activities->getValue($actresults,"results"); |
|
| 29 | +$results = $activities->getValue($actresults, "results"); |
|
| 30 | 30 | |
| 31 | 31 | foreach ($results as $result) { |
| 32 | 32 | Route4Me::simplePrint($result); |
@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | assert(!is_null($addressRand), "Can't retrieve random address"); |
| 28 | 28 | |
| 29 | 29 | if (isset($addressRand['is_depot'])) { |
| 30 | - if ($addressRand['is_depot']) { |
|
| 31 | - echo "This address is depot!.. Try again."; |
|
| 32 | - return; |
|
| 33 | - } |
|
| 30 | + if ($addressRand['is_depot']) { |
|
| 31 | + echo "This address is depot!.. Try again."; |
|
| 32 | + return; |
|
| 33 | + } |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | $route_destination_id = $addressRand['route_destination_id']; |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | // Remove the destination from the optimization |
| 41 | 41 | $params = array ( |
| 42 | - "optimization_problem_id" => $optimization_problem_id, |
|
| 43 | - "route_destination_id" => $route_destination_id |
|
| 42 | + "optimization_problem_id" => $optimization_problem_id, |
|
| 43 | + "route_destination_id" => $route_destination_id |
|
| 44 | 44 | ); |
| 45 | 45 | |
| 46 | 46 | $result = $optimization->removeAddress($params); |
@@ -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\Address; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | assert(!is_null($route_destination_id), "Can't retrieve random address"); |
| 39 | 39 | |
| 40 | 40 | // Remove the destination from the optimization |
| 41 | -$params = array ( |
|
| 41 | +$params = array( |
|
| 42 | 42 | "optimization_problem_id" => $optimization_problem_id, |
| 43 | 43 | "route_destination_id" => $route_destination_id |
| 44 | 44 | ); |
@@ -30,19 +30,19 @@ |
||
| 30 | 30 | $addresses = array(); |
| 31 | 31 | |
| 32 | 32 | $address1 = (array)Address::fromArray(array( |
| 33 | - 'address' => '717 5th Ave New York, NY 10021', |
|
| 34 | - 'alias' => 'Giorgio Armani', |
|
| 35 | - 'lat' => 40.7669692, |
|
| 36 | - 'lng' => 73.9693864, |
|
| 37 | - 'time' => 0 |
|
| 33 | + 'address' => '717 5th Ave New York, NY 10021', |
|
| 34 | + 'alias' => 'Giorgio Armani', |
|
| 35 | + 'lat' => 40.7669692, |
|
| 36 | + 'lng' => 73.9693864, |
|
| 37 | + 'time' => 0 |
|
| 38 | 38 | )); |
| 39 | 39 | |
| 40 | 40 | $addresses[0] = $address1; |
| 41 | 41 | |
| 42 | 42 | $OptimizationParameters = (array)OptimizationProblem::fromArray(array( |
| 43 | - "optimization_problem_id" => $optimization_problem_id, |
|
| 44 | - "addresses" => $addresses, |
|
| 45 | - "reoptimize" => 1, |
|
| 43 | + "optimization_problem_id" => $optimization_problem_id, |
|
| 44 | + "addresses" => $addresses, |
|
| 45 | + "reoptimize" => 1, |
|
| 46 | 46 | )); |
| 47 | 47 | |
| 48 | 48 | $optimizationproblem = new OptimizationProblem(); |
@@ -1,8 +1,8 @@ |
||
| 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\Route; |
@@ -25,20 +25,20 @@ |
||
| 25 | 25 | $addresses = array(); |
| 26 | 26 | |
| 27 | 27 | $params = array( |
| 28 | - "route_id" => $routeId, |
|
| 29 | - "addresses" => array( |
|
| 30 | - "0" => array( |
|
| 31 | - "address" => "Cabo Rojo, Cabo Rojo 00623, Puerto Rico", |
|
| 32 | - "alias" => "", |
|
| 33 | - "lat" => 18.086627, |
|
| 34 | - "lng" => -67.145735, |
|
| 35 | - "curbside_lat" => 18.086627, |
|
| 36 | - "curbside_lng" => -67.145735, |
|
| 37 | - "is_departed" => false, |
|
| 38 | - "is_visited" => false |
|
| 39 | - ) |
|
| 40 | - ), |
|
| 41 | - "optimal_position" => true |
|
| 28 | + "route_id" => $routeId, |
|
| 29 | + "addresses" => array( |
|
| 30 | + "0" => array( |
|
| 31 | + "address" => "Cabo Rojo, Cabo Rojo 00623, Puerto Rico", |
|
| 32 | + "alias" => "", |
|
| 33 | + "lat" => 18.086627, |
|
| 34 | + "lng" => -67.145735, |
|
| 35 | + "curbside_lat" => 18.086627, |
|
| 36 | + "curbside_lng" => -67.145735, |
|
| 37 | + "is_departed" => false, |
|
| 38 | + "is_visited" => false |
|
| 39 | + ) |
|
| 40 | + ), |
|
| 41 | + "optimal_position" => true |
|
| 42 | 42 | ); |
| 43 | 43 | |
| 44 | 44 | $route1 = new Route(); |
@@ -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\Route; |
@@ -52,5 +52,5 @@ discard block |
||
| 52 | 52 | assert(isset($result->addresses), "Can't insert a destination into the route"); |
| 53 | 53 | |
| 54 | 54 | foreach ($result->addresses as $address) { |
| 55 | - echo "Address -> " . $address->address , ", Sequence number -> " . $address->sequence_no . "<br>"; |
|
| 55 | + echo "Address -> ".$address->address, ", Sequence number -> ".$address->sequence_no."<br>"; |
|
| 56 | 56 | } |
@@ -29,10 +29,10 @@ |
||
| 29 | 29 | $address=new Address(); |
| 30 | 30 | |
| 31 | 31 | $params = array( |
| 32 | - "route_id" => $routeId, |
|
| 33 | - "address_id" => $route_destination_id, |
|
| 34 | - "is_departed" => 1, |
|
| 35 | - "member_id" => 1 |
|
| 32 | + "route_id" => $routeId, |
|
| 33 | + "address_id" => $route_destination_id, |
|
| 34 | + "is_departed" => 1, |
|
| 35 | + "member_id" => 1 |
|
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | 38 | $result = $address->markAsDeparted($params); |
@@ -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\Address; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | assert(!is_null($route_destination_id), "can't retrieve random address"); |
| 27 | 27 | |
| 28 | 28 | // Mark the address as deoarted |
| 29 | -$address=new Address(); |
|
| 29 | +$address = new Address(); |
|
| 30 | 30 | |
| 31 | 31 | $params = array( |
| 32 | 32 | "route_id" => $routeId, |
@@ -23,25 +23,25 @@ |
||
| 23 | 23 | $addresses = array(); |
| 24 | 24 | |
| 25 | 25 | $address1 = (array)Address::fromArray(array( |
| 26 | - 'address' => '146 Bill Johnson Rd NE Milledgeville GA 31061', |
|
| 27 | - 'lat' => 33.143526, |
|
| 28 | - 'lng' => -83.240354, |
|
| 29 | - 'time' => 0 |
|
| 26 | + 'address' => '146 Bill Johnson Rd NE Milledgeville GA 31061', |
|
| 27 | + 'lat' => 33.143526, |
|
| 28 | + 'lng' => -83.240354, |
|
| 29 | + 'time' => 0 |
|
| 30 | 30 | )); |
| 31 | 31 | |
| 32 | 32 | $address2 = (array)Address::fromArray(array( |
| 33 | - 'address' => '222 Blake Cir Milledgeville GA 31061', |
|
| 34 | - 'lat' => 33.177852, |
|
| 35 | - 'lng' => -83.263535, |
|
| 36 | - 'time' => 0 |
|
| 33 | + 'address' => '222 Blake Cir Milledgeville GA 31061', |
|
| 34 | + 'lat' => 33.177852, |
|
| 35 | + 'lng' => -83.263535, |
|
| 36 | + 'time' => 0 |
|
| 37 | 37 | )); |
| 38 | 38 | |
| 39 | 39 | $addresses[] = $address1; |
| 40 | 40 | $addresses[] = $address2; |
| 41 | 41 | |
| 42 | 42 | $routeParameters = array( |
| 43 | - "route_id" => $routeId, |
|
| 44 | - "addresses" => array($address1, $address2) |
|
| 43 | + "route_id" => $routeId, |
|
| 44 | + "addresses" => array($address1, $address2) |
|
| 45 | 45 | ); |
| 46 | 46 | |
| 47 | 47 | $route1 = new Route(); |
@@ -1,8 +1,8 @@ |
||
| 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\Route; |
@@ -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\Route; |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | // Get random source route from test routes |
| 28 | 28 | $route = new Route(); |
| 29 | 29 | |
| 30 | -$route_id0 = $routes[rand(0, sizeof($routes)-1)]->route_id; |
|
| 30 | +$route_id0 = $routes[rand(0, sizeof($routes) - 1)]->route_id; |
|
| 31 | 31 | |
| 32 | -echo "<br> From the route -> " . $route_id0 ."<br>"; |
|
| 32 | +echo "<br> From the route -> ".$route_id0."<br>"; |
|
| 33 | 33 | |
| 34 | 34 | if (is_null($route_id0)) { |
| 35 | 35 | echo "Can't retrieve random route_id!.. Try again."; |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // Get random source destination from selected source route above |
| 40 | -$addressRand=(array)$route->GetRandomAddressFromRoute($route_id0); |
|
| 41 | -$route_destination_id=$addressRand['route_destination_id']; |
|
| 40 | +$addressRand = (array)$route->GetRandomAddressFromRoute($route_id0); |
|
| 41 | +$route_destination_id = $addressRand['route_destination_id']; |
|
| 42 | 42 | |
| 43 | 43 | assert(!is_null($route_destination_id), "Can't retrieve random address."); |
| 44 | 44 | |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | // Get random destination route from test routes |
| 48 | 48 | $to_route_id = $route_id0; |
| 49 | 49 | |
| 50 | -while ($to_route_id == $route_id0) { |
|
| 51 | - $to_route_id = $routes[rand(0, sizeof($routes)-1)]->route_id; |
|
| 50 | +while ($to_route_id==$route_id0) { |
|
| 51 | + $to_route_id = $routes[rand(0, sizeof($routes) - 1)]->route_id; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -echo "<br> to the route -> " . $to_route_id ."<br>"; |
|
| 54 | +echo "<br> to the route -> ".$to_route_id."<br>"; |
|
| 55 | 55 | |
| 56 | 56 | if (is_null($to_route_id)) { |
| 57 | 57 | echo "Can't retrieve random route_id!.. Try again."; |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | $route = new Route(); |
| 17 | 17 | |
| 18 | 18 | $grParams = array( |
| 19 | - 'offset' => 0, |
|
| 20 | - 'limit' => 10 |
|
| 19 | + 'offset' => 0, |
|
| 20 | + 'limit' => 10 |
|
| 21 | 21 | ); |
| 22 | 22 | |
| 23 | 23 | $routes = $route->getRoutes($grParams); |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | echo "<br> From the route -> " . $route_id0 ."<br>"; |
| 33 | 33 | |
| 34 | 34 | if (is_null($route_id0)) { |
| 35 | - echo "Can't retrieve random route_id!.. Try again."; |
|
| 36 | - return; |
|
| 35 | + echo "Can't retrieve random route_id!.. Try again."; |
|
| 36 | + return; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // Get random source destination from selected source route above |
@@ -48,14 +48,14 @@ discard block |
||
| 48 | 48 | $to_route_id = $route_id0; |
| 49 | 49 | |
| 50 | 50 | while ($to_route_id == $route_id0) { |
| 51 | - $to_route_id = $routes[rand(0, sizeof($routes)-1)]->route_id; |
|
| 51 | + $to_route_id = $routes[rand(0, sizeof($routes)-1)]->route_id; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | echo "<br> to the route -> " . $to_route_id ."<br>"; |
| 55 | 55 | |
| 56 | 56 | if (is_null($to_route_id)) { |
| 57 | - echo "Can't retrieve random route_id!.. Try again."; |
|
| 58 | - return; |
|
| 57 | + echo "Can't retrieve random route_id!.. Try again."; |
|
| 58 | + return; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // Get random destination destination from selected source route above |
@@ -64,17 +64,17 @@ discard block |
||
| 64 | 64 | $after_destination_id = $addressRand2['route_destination_id']; |
| 65 | 65 | |
| 66 | 66 | if (is_null($after_destination_id)) { |
| 67 | - echo "can't retrieve random address!.. Try again."; |
|
| 68 | - return; |
|
| 67 | + echo "can't retrieve random address!.. Try again."; |
|
| 68 | + return; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | echo "after_destination_id = $after_destination_id <br>"; |
| 72 | 72 | |
| 73 | 73 | // Move the destination to the route |
| 74 | 74 | $routeparams = array( |
| 75 | - 'to_route_id' => $to_route_id, |
|
| 76 | - 'route_destination_id' => strval($route_destination_id), |
|
| 77 | - 'after_destination_id' => strval($after_destination_id) |
|
| 75 | + 'to_route_id' => $to_route_id, |
|
| 76 | + 'route_destination_id' => strval($route_destination_id), |
|
| 77 | + 'after_destination_id' => strval($after_destination_id) |
|
| 78 | 78 | ); |
| 79 | 79 | |
| 80 | 80 | $address = new Address(); |
@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | $addressRand=(array)$route->GetRandomAddressFromRoute($routeId); |
| 24 | 24 | |
| 25 | 25 | if (isset($addressRand['is_depot'])) { |
| 26 | - if ($addressRand['is_depot']) { |
|
| 27 | - echo "Random choosed address is depot, it can't be marked!.. Try again."; |
|
| 28 | - return; |
|
| 29 | - } |
|
| 26 | + if ($addressRand['is_depot']) { |
|
| 27 | + echo "Random choosed address is depot, it can't be marked!.. Try again."; |
|
| 28 | + return; |
|
| 29 | + } |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | // Get random address's id from selected route above |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | $address = new Address(); |
| 40 | 40 | |
| 41 | 41 | $params = array( |
| 42 | - "route_id" => $routeId, |
|
| 43 | - "address_id" => $route_destination_id, |
|
| 44 | - "is_visited" => 1, |
|
| 45 | - "member_id" => 1 |
|
| 42 | + "route_id" => $routeId, |
|
| 43 | + "address_id" => $route_destination_id, |
|
| 44 | + "is_visited" => 1, |
|
| 45 | + "member_id" => 1 |
|
| 46 | 46 | ); |
| 47 | 47 | |
| 48 | 48 | $result = $address->markAsVisited($params); |
@@ -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\Address; |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | assert(!is_null($routeId), "can't retrieve random route_id"); |
| 21 | 21 | |
| 22 | 22 | // Get random address's id from selected route above |
| 23 | -$addressRand=(array)$route->GetRandomAddressFromRoute($routeId); |
|
| 23 | +$addressRand = (array)$route->GetRandomAddressFromRoute($routeId); |
|
| 24 | 24 | |
| 25 | 25 | if (isset($addressRand['is_depot'])) { |
| 26 | 26 | if ($addressRand['is_depot']) { |
@@ -49,4 +49,4 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | assert($result==1, "Cannot marked the address as visited"); |
| 51 | 51 | |
| 52 | -echo "<br> The address " . $route_destination_id . " was marked as visited"; |
|
| 52 | +echo "<br> The address ".$route_destination_id." was marked as visited"; |
|