@@ -33,19 +33,19 @@ |
||
33 | 33 | echo "randomKey -> $randomKey <br><br>"; |
34 | 34 | |
35 | 35 | $params = Member::fromArray(array ( |
36 | - "config_key"=> $randomKey |
|
36 | + "config_key"=> $randomKey |
|
37 | 37 | )); |
38 | 38 | |
39 | 39 | $response = $member->getMemberConfigData($params); |
40 | 40 | |
41 | 41 | foreach ($response as $key => $value) |
42 | 42 | { |
43 | - if (is_array($value)) |
|
44 | - { |
|
45 | - Route4Me::simplePrint($value); |
|
46 | - } |
|
47 | - else |
|
48 | - { |
|
49 | - echo "$key => $value <br>"; |
|
50 | - } |
|
43 | + if (is_array($value)) |
|
44 | + { |
|
45 | + Route4Me::simplePrint($value); |
|
46 | + } |
|
47 | + else |
|
48 | + { |
|
49 | + echo "$key => $value <br>"; |
|
50 | + } |
|
51 | 51 | } |
@@ -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; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $member = new Member(); |
19 | 19 | |
20 | 20 | // Get a random member config key |
21 | -$randomParams = Member::fromArray(array ( |
|
21 | +$randomParams = Member::fromArray(array( |
|
22 | 22 | )); |
23 | 23 | |
24 | 24 | $response = $member->getMemberConfigData($randomParams); |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | assert(sizeof($response)==2, "Cannot retrieve all config data"); |
28 | 28 | assert(isset($response['data']), "Cannot retrieve all config data"); |
29 | 29 | |
30 | -$randomKey = $response['data'][rand(0, sizeof($response['data'])-1)]['config_key']; |
|
30 | +$randomKey = $response['data'][rand(0, sizeof($response['data']) - 1)]['config_key']; |
|
31 | 31 | |
32 | 32 | // Get a specified single configuration key data |
33 | 33 | echo "randomKey -> $randomKey <br><br>"; |
34 | 34 | |
35 | -$params = Member::fromArray(array ( |
|
35 | +$params = Member::fromArray(array( |
|
36 | 36 | "config_key"=> $randomKey |
37 | 37 | )); |
38 | 38 |
@@ -24,8 +24,7 @@ |
||
24 | 24 | if (is_array($value)) |
25 | 25 | { |
26 | 26 | Route4Me::simplePrint($value); |
27 | - } |
|
28 | - else |
|
27 | + } else |
|
29 | 28 | { |
30 | 29 | echo "$key => $value <br>"; |
31 | 30 | } |
@@ -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 | } |
@@ -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; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | // Set the api key in the Route4Me class |
14 | 14 | Route4Me::setApiKey('11111111111111111111111111111111'); |
15 | 15 | |
16 | -$route=new Route(); |
|
16 | +$route = new Route(); |
|
17 | 17 | |
18 | 18 | // Get random route ID |
19 | 19 | $randomRouteID = $route->getRandomRouteId(0, 25); |
@@ -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'; |
@@ -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\Route4Me; |
@@ -31,38 +31,38 @@ |
||
31 | 31 | $route->parameters = new \stdClass(); |
32 | 32 | |
33 | 33 | $route->addresses = array( Address::fromArray(array( |
34 | - "alias" => "new address alias", |
|
35 | - "first_name" => "Edi", |
|
36 | - "last_name" => "Jacobson", |
|
37 | - "address" => "230 Arbor Way Milledgeville GA 31061", |
|
38 | - "is_depot" => false, |
|
39 | - "lat" => 33.129695892334, |
|
40 | - "lng" => -83.24577331543, |
|
41 | - "sequence_no" => 9, |
|
42 | - "is_visited" => true, |
|
43 | - "is_departed" => false, |
|
44 | - "timestamp_last_visited" => 36000, |
|
45 | - "timestamp_last_departed" => null, |
|
46 | - "customer_po" => "po_131324566", |
|
47 | - "invoice_no" => "in549874", |
|
48 | - "reference_no" => "7988544", |
|
49 | - "order_no" => "on654754", |
|
50 | - "order_id" => 4564, |
|
51 | - "weight" => 45, |
|
52 | - "cost" => 55.60, |
|
53 | - "revenue" => 75.80, |
|
54 | - "cube" => 3, |
|
55 | - "pieces" => 30, |
|
56 | - "email" => "[email protected]", |
|
57 | - "phone" => "111-222-333", |
|
58 | - "time_window_start" => 36600, |
|
59 | - "time_window_end" => 37200, |
|
60 | - "time" => 600, |
|
61 | - "priority" => 1, |
|
62 | - "curbside_lat" => 33.129695892334, |
|
63 | - "curbside_lng" => -83.24577331543, |
|
64 | - "time_window_start_2" => 39400, |
|
65 | - "time_window_end_2" => 40000 |
|
34 | + "alias" => "new address alias", |
|
35 | + "first_name" => "Edi", |
|
36 | + "last_name" => "Jacobson", |
|
37 | + "address" => "230 Arbor Way Milledgeville GA 31061", |
|
38 | + "is_depot" => false, |
|
39 | + "lat" => 33.129695892334, |
|
40 | + "lng" => -83.24577331543, |
|
41 | + "sequence_no" => 9, |
|
42 | + "is_visited" => true, |
|
43 | + "is_departed" => false, |
|
44 | + "timestamp_last_visited" => 36000, |
|
45 | + "timestamp_last_departed" => null, |
|
46 | + "customer_po" => "po_131324566", |
|
47 | + "invoice_no" => "in549874", |
|
48 | + "reference_no" => "7988544", |
|
49 | + "order_no" => "on654754", |
|
50 | + "order_id" => 4564, |
|
51 | + "weight" => 45, |
|
52 | + "cost" => 55.60, |
|
53 | + "revenue" => 75.80, |
|
54 | + "cube" => 3, |
|
55 | + "pieces" => 30, |
|
56 | + "email" => "[email protected]", |
|
57 | + "phone" => "111-222-333", |
|
58 | + "time_window_start" => 36600, |
|
59 | + "time_window_end" => 37200, |
|
60 | + "time" => 600, |
|
61 | + "priority" => 1, |
|
62 | + "curbside_lat" => 33.129695892334, |
|
63 | + "curbside_lng" => -83.24577331543, |
|
64 | + "time_window_start_2" => 39400, |
|
65 | + "time_window_end_2" => 40000 |
|
66 | 66 | ))); |
67 | 67 | |
68 | 68 | $route->httpheaders = 'Content-type: application/json'; |
@@ -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; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | // Update the route destination |
31 | 31 | $route->parameters = new \stdClass(); |
32 | 32 | |
33 | -$route->addresses = array( Address::fromArray(array( |
|
33 | +$route->addresses = array(Address::fromArray(array( |
|
34 | 34 | "alias" => "new address alias", |
35 | 35 | "first_name" => "Edi", |
36 | 36 | "last_name" => "Jacobson", |
@@ -30,7 +30,7 @@ |
||
30 | 30 | $route->parameters = new \stdClass(); |
31 | 31 | |
32 | 32 | $route->parameters = array( |
33 | - "recompute_directions" => 1 |
|
33 | + "recompute_directions" => 1 |
|
34 | 34 | ); |
35 | 35 | |
36 | 36 | $route->httpheaders = 'Content-type: application/json'; |
@@ -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\Route4Me; |
@@ -21,9 +21,9 @@ |
||
21 | 21 | |
22 | 22 | // Resequence all addresses |
23 | 23 | $params = array( |
24 | - "route_id" => $route_id, |
|
25 | - "disable_optimization" => 0, |
|
26 | - "optimize" => "Distance" |
|
24 | + "route_id" => $route_id, |
|
25 | + "disable_optimization" => 0, |
|
26 | + "optimize" => "Distance" |
|
27 | 27 | ); |
28 | 28 | |
29 | 29 | $resequence = $route->resequenceAllAddresses($params); |
@@ -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\Route4Me; |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | $count = 0; |
26 | 26 | |
27 | 27 | while ($route_id1 == $route_id2) { |
28 | - $route_id2 = $route->getRandomRouteId(0, 20); |
|
28 | + $route_id2 = $route->getRandomRouteId(0, 20); |
|
29 | 29 | |
30 | - $count++; |
|
30 | + $count++; |
|
31 | 31 | |
32 | - if ($count>5) break; // prevent from the infinite cycle, if there are less than 2 routes. |
|
32 | + if ($count>5) break; // prevent from the infinite cycle, if there are less than 2 routes. |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | echo "Route ID 1 -> $route_id1 <br> Route ID 2 -> $route_id2 <br>"; |
@@ -41,21 +41,21 @@ discard block |
||
41 | 41 | $depot = null; |
42 | 42 | |
43 | 43 | foreach ($addresses as $address) { |
44 | - if (isset($address->is_depot)) { |
|
45 | - if ($address->is_depot == true) { |
|
46 | - $depot = $address; |
|
47 | - break; |
|
48 | - } |
|
49 | - } |
|
44 | + if (isset($address->is_depot)) { |
|
45 | + if ($address->is_depot == true) { |
|
46 | + $depot = $address; |
|
47 | + break; |
|
48 | + } |
|
49 | + } |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | // Merge the selected routes |
53 | 53 | $params = array( |
54 | - "route_ids" => $route_id1.",".$route_id2, |
|
55 | - "depot_address" => $depot->address, |
|
56 | - "remove_origin" => false, |
|
57 | - "depot_lat" => $depot->lat, |
|
58 | - "depot_lat" => $depot->lng |
|
54 | + "route_ids" => $route_id1.",".$route_id2, |
|
55 | + "depot_address" => $depot->address, |
|
56 | + "remove_origin" => false, |
|
57 | + "depot_lat" => $depot->lat, |
|
58 | + "depot_lat" => $depot->lng |
|
59 | 59 | ); |
60 | 60 | |
61 | 61 | $result = $route->mergeRoutes($params); |
@@ -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; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | $count = 0; |
26 | 26 | |
27 | -while ($route_id1 == $route_id2) { |
|
27 | +while ($route_id1==$route_id2) { |
|
28 | 28 | $route_id2 = $route->getRandomRouteId(0, 20); |
29 | 29 | |
30 | 30 | $count++; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | foreach ($addresses as $address) { |
44 | 44 | if (isset($address->is_depot)) { |
45 | - if ($address->is_depot == true) { |
|
45 | + if ($address->is_depot==true) { |
|
46 | 46 | $depot = $address; |
47 | 47 | break; |
48 | 48 | } |
@@ -29,7 +29,10 @@ |
||
29 | 29 | |
30 | 30 | $count++; |
31 | 31 | |
32 | - if ($count>5) break; // prevent from the infinite cycle, if there are less than 2 routes. |
|
32 | + if ($count>5) { |
|
33 | + break; |
|
34 | + } |
|
35 | + // prevent from the infinite cycle, if there are less than 2 routes. |
|
33 | 36 | } |
34 | 37 | |
35 | 38 | echo "Route ID 1 -> $route_id1 <br> Route ID 2 -> $route_id2 <br>"; |