@@ -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,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\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."; |
@@ -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"; |
@@ -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\Enum\DeviceType; |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | assert($status['status'], "Can't send GPS position to the selected route"); |
47 | 47 | |
48 | 48 | // Get the device tracking history from a time range |
49 | -$startDate = time() - 30*24*3600; |
|
50 | -$endDate = time() + 1*24*3600; |
|
49 | +$startDate = time() - 30 * 24 * 3600; |
|
50 | +$endDate = time() + 1 * 24 * 3600; |
|
51 | 51 | |
52 | 52 | $params = array( |
53 | 53 | 'route_id' => $routeId, |
@@ -1,7 +1,7 @@ |
||
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\Enum\DeviceType; |