@@ -12,7 +12,7 @@ |
||
| 12 | 12 | public function toArray() |
| 13 | 13 | { |
| 14 | 14 | $params = array_filter(get_object_vars($this), function($item) { |
| 15 | - return ($item !== null) && !(is_array($item) && !count($item)); |
|
| 15 | + return ($item!==null) && !(is_array($item) && !count($item)); |
|
| 16 | 16 | }); |
| 17 | 17 | |
| 18 | 18 | return $params; |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | public static function fromArray(array $params) |
| 49 | 49 | { |
| 50 | 50 | $routeParams = new RouteParameters(); |
| 51 | - foreach($params as $key => $value) { |
|
| 51 | + foreach ($params as $key => $value) { |
|
| 52 | 52 | if (property_exists($routeParams, $key)) { |
| 53 | 53 | $routeParams->{$key} = $value; |
| 54 | 54 | } |
@@ -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>"; |
@@ -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->get($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); |
@@ -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 | ); |
@@ -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 | } |
@@ -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; |
@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | assert(!is_null($address_id), "can't retrieve random address"); |
| 37 | 37 | |
| 38 | 38 | // Mark the address as detected as visited |
| 39 | -$addressParameters=(array)Address::fromArray(array( |
|
| 39 | +$addressParameters = (array)Address::fromArray(array( |
|
| 40 | 40 | "route_id" => $routeId, |
| 41 | 41 | "route_destination_id" => $address_id, |
| 42 | 42 | )); |
| 43 | 43 | |
| 44 | -$body= array( |
|
| 44 | +$body = array( |
|
| 45 | 45 | "is_visited" => TRUE, |
| 46 | 46 | ); |
| 47 | 47 | |
@@ -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, |
@@ -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."; |