@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | // Select a terriotry with the addresses from the list |
19 | 19 | $params = array( |
20 | - "offset" => 0, |
|
21 | - "limit" => 50, |
|
22 | - "addresses" => 1 |
|
20 | + "offset" => 0, |
|
21 | + "limit" => 50, |
|
22 | + "addresses" => 1 |
|
23 | 23 | ); |
24 | 24 | |
25 | 25 | $results = $territory->getTerritories($params); |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | $territory1 = null; |
29 | 29 | |
30 | 30 | foreach ($results as $terr) { |
31 | - if (isset($terr['addresses'])) { |
|
32 | - if (sizeof($terr['addresses'])>0) { |
|
33 | - $territory1 = $terr; |
|
34 | - break; |
|
35 | - } |
|
36 | - } |
|
31 | + if (isset($terr['addresses'])) { |
|
32 | + if (sizeof($terr['addresses'])>0) { |
|
33 | + $territory1 = $terr; |
|
34 | + break; |
|
35 | + } |
|
36 | + } |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | assert(isset($territory1['territory_id']), "Can't retrieve a random territory ID"); |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | |
44 | 44 | // Get a territory with the addresses |
45 | 45 | $params = array( |
46 | - "territory_id" => $territory_id, |
|
47 | - "addresses" => 1 |
|
46 | + "territory_id" => $territory_id, |
|
47 | + "addresses" => 1 |
|
48 | 48 | ); |
49 | 49 | |
50 | 50 | $result1 = $territory->getTerritory($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; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | // Set the api key in the Route4Me class |
14 | 14 | Route4Me::setApiKey('11111111111111111111111111111111'); |
15 | 15 | |
16 | -$territory=new Territory(); |
|
16 | +$territory = new Territory(); |
|
17 | 17 | |
18 | 18 | // Select a terriotry with the addresses from the list |
19 | 19 | $params = array( |
@@ -13,13 +13,13 @@ |
||
13 | 13 | $territory = new Territory(); |
14 | 14 | |
15 | 15 | $queryparameters = array ( |
16 | - "offset" => 0, |
|
17 | - "limit" => 20 |
|
16 | + "offset" => 0, |
|
17 | + "limit" => 20 |
|
18 | 18 | ); |
19 | 19 | |
20 | 20 | $response = $territory->getTerritories($queryparameters); |
21 | 21 | |
22 | 22 | foreach ($response as $terr1) { |
23 | 23 | Route4Me::simplePrint($terr1, true); |
24 | - echo "<br>"; |
|
24 | + echo "<br>"; |
|
25 | 25 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | $territory = new Territory(); |
14 | 14 | |
15 | -$queryparameters = array ( |
|
15 | +$queryparameters = array( |
|
16 | 16 | "offset" => 0, |
17 | 17 | "limit" => 20 |
18 | 18 | ); |
@@ -26,23 +26,23 @@ 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" => "Multiple Depot, Multiple Driver, 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 * 3, |
|
43 | - "travel_mode" => TravelMode::DRIVING, |
|
44 | - "vehicle_capacity" => 99, |
|
45 | - "vehicle_max_distance_mi" => 99999 |
|
33 | + "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
|
34 | + "route_name" => "Multiple Depot, Multiple Driver, 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 * 3, |
|
43 | + "travel_mode" => TravelMode::DRIVING, |
|
44 | + "vehicle_capacity" => 99, |
|
45 | + "vehicle_max_distance_mi" => 99999 |
|
46 | 46 | )); |
47 | 47 | |
48 | 48 | $optimizationParams = new OptimizationProblemParams; |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | $problem = OptimizationProblem::optimize($optimizationParams); |
53 | 53 | |
54 | 54 | foreach ((array)$problem as $key => $value) { |
55 | - if (is_string($value)) { |
|
56 | - echo $key." --> ".$value."<br>"; |
|
57 | - } else { |
|
58 | - echo "************ $key ************* <br>"; |
|
59 | - Route4Me::simplePrint((array)$value, true); |
|
60 | - echo "******************************* <br>"; |
|
61 | - } |
|
55 | + if (is_string($value)) { |
|
56 | + echo $key." --> ".$value."<br>"; |
|
57 | + } else { |
|
58 | + echo "************ $key ************* <br>"; |
|
59 | + Route4Me::simplePrint((array)$value, true); |
|
60 | + echo "******************************* <br>"; |
|
61 | + } |
|
62 | 62 | } |
63 | 63 |
@@ -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" => "Multiple Depot, Multiple Driver, 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, |
@@ -33,7 +33,7 @@ |
||
33 | 33 | { |
34 | 34 | $activityparameters = new ActivityParameters(); |
35 | 35 | |
36 | - foreach($params as $key => $value) { |
|
36 | + foreach ($params as $key => $value) { |
|
37 | 37 | if (property_exists($activityparameters, $key)) { |
38 | 38 | $activityparameters->{$key} = $value; |
39 | 39 | } |
@@ -6,79 +6,79 @@ |
||
6 | 6 | |
7 | 7 | class ActivityParameters extends Common |
8 | 8 | { |
9 | - public $route_id; |
|
10 | - public $device_id; |
|
11 | - public $member_id; |
|
12 | - public $team; |
|
13 | - public $limit; |
|
14 | - public $offset; |
|
15 | - public $start; |
|
16 | - public $end; |
|
17 | - public $activity_type; |
|
18 | - public $activity_message; |
|
9 | + public $route_id; |
|
10 | + public $device_id; |
|
11 | + public $member_id; |
|
12 | + public $team; |
|
13 | + public $limit; |
|
14 | + public $offset; |
|
15 | + public $start; |
|
16 | + public $end; |
|
17 | + public $activity_type; |
|
18 | + public $activity_message; |
|
19 | 19 | |
20 | - public $activity_id; |
|
21 | - public $activity_timestamp; |
|
22 | - public $route_destination_id; |
|
23 | - public $note_id; |
|
24 | - public $member; |
|
25 | - public $note_type; |
|
26 | - public $note_contents; |
|
27 | - public $route_name; |
|
28 | - public $note_file; |
|
29 | - public $destination_name; |
|
30 | - public $destination_alias; |
|
20 | + public $activity_id; |
|
21 | + public $activity_timestamp; |
|
22 | + public $route_destination_id; |
|
23 | + public $note_id; |
|
24 | + public $member; |
|
25 | + public $note_type; |
|
26 | + public $note_contents; |
|
27 | + public $route_name; |
|
28 | + public $note_file; |
|
29 | + public $destination_name; |
|
30 | + public $destination_alias; |
|
31 | 31 | |
32 | - public static function fromArray(array $params) |
|
33 | - { |
|
34 | - $activityparameters = new ActivityParameters(); |
|
32 | + public static function fromArray(array $params) |
|
33 | + { |
|
34 | + $activityparameters = new ActivityParameters(); |
|
35 | 35 | |
36 | - foreach($params as $key => $value) { |
|
37 | - if (property_exists($activityparameters, $key)) { |
|
38 | - $activityparameters->{$key} = $value; |
|
39 | - } |
|
40 | - } |
|
36 | + foreach($params as $key => $value) { |
|
37 | + if (property_exists($activityparameters, $key)) { |
|
38 | + $activityparameters->{$key} = $value; |
|
39 | + } |
|
40 | + } |
|
41 | 41 | |
42 | - return $activityparameters; |
|
43 | - } |
|
42 | + return $activityparameters; |
|
43 | + } |
|
44 | 44 | |
45 | - public static function getActivities($params) |
|
46 | - { |
|
47 | - $allQueryFields = array('route_id', 'team', 'limit', 'offset', 'start'); |
|
45 | + public static function getActivities($params) |
|
46 | + { |
|
47 | + $allQueryFields = array('route_id', 'team', 'limit', 'offset', 'start'); |
|
48 | 48 | |
49 | - $activity = Route4Me::makeRequst(array( |
|
50 | - 'url' => Endpoint::GET_ACTIVITIES, |
|
51 | - 'method' => 'GET', |
|
52 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
53 | - )); |
|
49 | + $activity = Route4Me::makeRequst(array( |
|
50 | + 'url' => Endpoint::GET_ACTIVITIES, |
|
51 | + 'method' => 'GET', |
|
52 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
53 | + )); |
|
54 | 54 | |
55 | - return $activity; |
|
56 | - } |
|
55 | + return $activity; |
|
56 | + } |
|
57 | 57 | |
58 | - public static function searcActivities($params) |
|
59 | - { |
|
60 | - $allQueryFields = array('route_id', 'limit', 'offset', 'activity_type'); |
|
58 | + public static function searcActivities($params) |
|
59 | + { |
|
60 | + $allQueryFields = array('route_id', 'limit', 'offset', 'activity_type'); |
|
61 | 61 | |
62 | - $activity = Route4Me::makeRequst(array( |
|
63 | - 'url' => Endpoint::GET_ACTIVITIES, |
|
64 | - 'method' => 'GET', |
|
65 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
66 | - )); |
|
62 | + $activity = Route4Me::makeRequst(array( |
|
63 | + 'url' => Endpoint::GET_ACTIVITIES, |
|
64 | + 'method' => 'GET', |
|
65 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
66 | + )); |
|
67 | 67 | |
68 | - return $activity; |
|
69 | - } |
|
68 | + return $activity; |
|
69 | + } |
|
70 | 70 | |
71 | - public static function sendUserMessage($params) |
|
72 | - { |
|
73 | - $allBodyFields = array('activity_type', 'activity_message', 'route_id'); |
|
71 | + public static function sendUserMessage($params) |
|
72 | + { |
|
73 | + $allBodyFields = array('activity_type', 'activity_message', 'route_id'); |
|
74 | 74 | |
75 | - $result = Route4Me::makeRequst(array( |
|
76 | - 'url' => Endpoint::ACTIVITY_FEED, |
|
77 | - 'method' => 'POST', |
|
78 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
79 | - )); |
|
75 | + $result = Route4Me::makeRequst(array( |
|
76 | + 'url' => Endpoint::ACTIVITY_FEED, |
|
77 | + 'method' => 'POST', |
|
78 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
79 | + )); |
|
80 | 80 | |
81 | - return $result; |
|
82 | - } |
|
81 | + return $result; |
|
82 | + } |
|
83 | 83 | |
84 | 84 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | class Territory extends Common |
9 | 9 | { |
10 | - public $territory_id; // Territory id |
|
10 | + public $territory_id; // Territory id |
|
11 | 11 | public $territory_name; |
12 | 12 | public $territory_color; |
13 | 13 | public $addresses; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | $territoryparameters = new Territory(); |
31 | 31 | |
32 | - foreach($params as $key => $value) { |
|
32 | + foreach ($params as $key => $value) { |
|
33 | 33 | if (property_exists($territoryparameters, $key)) { |
34 | 34 | $territoryparameters->{$key} = $value; |
35 | 35 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | public static function getTerritory($params) |
42 | 42 | { |
43 | - $allQueryFields = array('territory_id', 'addresses'); |
|
43 | + $allQueryFields = array('territory_id', 'addresses'); |
|
44 | 44 | |
45 | 45 | $territory = Route4Me::makeRequst(array( |
46 | 46 | 'url' => Endpoint::TERRITORY_V4, |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | public static function getTerritories($params) |
55 | 55 | { |
56 | - $allQueryFields = array('offset', 'limit', 'addresses'); |
|
56 | + $allQueryFields = array('offset', 'limit', 'addresses'); |
|
57 | 57 | |
58 | 58 | $response = Route4Me::makeRequst(array( |
59 | 59 | 'url' => Endpoint::TERRITORY_V4, |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | public static function addTerritory($params) |
68 | 68 | { |
69 | - $allBodyFields = array('territory_name', 'member_id', 'territory_color', 'territory'); |
|
69 | + $allBodyFields = array('territory_name', 'member_id', 'territory_color', 'territory'); |
|
70 | 70 | |
71 | 71 | $response = Route4Me::makeRequst(array( |
72 | 72 | 'url' => Endpoint::TERRITORY_V4, |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | |
93 | 93 | public function updateTerritory($params) |
94 | 94 | { |
95 | - $allQueryFields = array('territory_id'); |
|
96 | - $allBodyFields = array('territory_name', 'member_id', 'territory_color', 'territory'); |
|
95 | + $allQueryFields = array('territory_id'); |
|
96 | + $allBodyFields = array('territory_name', 'member_id', 'territory_color', 'territory'); |
|
97 | 97 | |
98 | 98 | $response = Route4Me::makeRequst(array( |
99 | 99 | 'url' => Endpoint::TERRITORY_V4, |
100 | 100 | 'method' => 'PUT', |
101 | 101 | 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
102 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
102 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
103 | 103 | )); |
104 | 104 | |
105 | 105 | return $response; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $param->setParameters(RouteParameters::fromArray($params['parameters'])); |
35 | 35 | } |
36 | 36 | |
37 | - foreach($params['addresses'] as $address) { |
|
37 | + foreach ($params['addresses'] as $address) { |
|
38 | 38 | if (!($address instanceof Address)) { |
39 | 39 | $address = Address::fromArray($address); |
40 | 40 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | { |
78 | 78 | $addresses = array(); |
79 | 79 | |
80 | - foreach($this->addresses as $address) { |
|
80 | + foreach ($this->addresses as $address) { |
|
81 | 81 | $addresses[] = $address->toArray(); |
82 | 82 | } |
83 | 83 |
@@ -7,93 +7,93 @@ |
||
7 | 7 | |
8 | 8 | class OptimizationProblemParams extends Common |
9 | 9 | { |
10 | - public $optimization_problem_id; |
|
11 | - public $reoptimize; |
|
12 | - public $addresses = array(); |
|
13 | - public $parameters; |
|
14 | - public $directions; |
|
15 | - public $format; |
|
16 | - public $route_path_output; |
|
17 | - public $optimized_callback_url; |
|
18 | - public $redirect = true; |
|
10 | + public $optimization_problem_id; |
|
11 | + public $reoptimize; |
|
12 | + public $addresses = array(); |
|
13 | + public $parameters; |
|
14 | + public $directions; |
|
15 | + public $format; |
|
16 | + public $route_path_output; |
|
17 | + public $optimized_callback_url; |
|
18 | + public $redirect = true; |
|
19 | 19 | |
20 | - public static function fromArray($params) |
|
21 | - { |
|
22 | - $param = new OptimizationProblemParams; |
|
23 | - if (!isset($params['addresses'])) { |
|
24 | - throw new BadParam('addresses must be provided.'); |
|
25 | - } |
|
20 | + public static function fromArray($params) |
|
21 | + { |
|
22 | + $param = new OptimizationProblemParams; |
|
23 | + if (!isset($params['addresses'])) { |
|
24 | + throw new BadParam('addresses must be provided.'); |
|
25 | + } |
|
26 | 26 | |
27 | - if (!isset($params['parameters'])) { |
|
28 | - throw new BadParam('parameters must be provided.'); |
|
29 | - } |
|
27 | + if (!isset($params['parameters'])) { |
|
28 | + throw new BadParam('parameters must be provided.'); |
|
29 | + } |
|
30 | 30 | |
31 | - if ($params['parameters'] instanceof RouteParameters) { |
|
32 | - $param->setParameters($params['parameters']); |
|
33 | - } else { |
|
34 | - $param->setParameters(RouteParameters::fromArray($params['parameters'])); |
|
35 | - } |
|
31 | + if ($params['parameters'] instanceof RouteParameters) { |
|
32 | + $param->setParameters($params['parameters']); |
|
33 | + } else { |
|
34 | + $param->setParameters(RouteParameters::fromArray($params['parameters'])); |
|
35 | + } |
|
36 | 36 | |
37 | - foreach($params['addresses'] as $address) { |
|
38 | - if (!($address instanceof Address)) { |
|
39 | - $address = Address::fromArray($address); |
|
40 | - } |
|
37 | + foreach($params['addresses'] as $address) { |
|
38 | + if (!($address instanceof Address)) { |
|
39 | + $address = Address::fromArray($address); |
|
40 | + } |
|
41 | 41 | |
42 | - $param->addAddress($address); |
|
43 | - } |
|
42 | + $param->addAddress($address); |
|
43 | + } |
|
44 | 44 | |
45 | - $param->directions = self::getValue($params, 'directions'); |
|
46 | - $param->format = self::getValue($params, 'format'); |
|
47 | - $param->route_path_output = self::getValue($params, 'route_path_output'); |
|
48 | - $param->optimized_callback_url = self::getValue($params, 'optimized_callback_url'); |
|
49 | - $param->optimization_problem_id = self::getValue($params, 'optimization_problem_id'); |
|
50 | - $param->reoptimize = self::getValue($params, 'reoptimize'); |
|
51 | - $param->redirect = filter_var(self::getValue($params, 'redirect', true), FILTER_VALIDATE_BOOLEAN); |
|
45 | + $param->directions = self::getValue($params, 'directions'); |
|
46 | + $param->format = self::getValue($params, 'format'); |
|
47 | + $param->route_path_output = self::getValue($params, 'route_path_output'); |
|
48 | + $param->optimized_callback_url = self::getValue($params, 'optimized_callback_url'); |
|
49 | + $param->optimization_problem_id = self::getValue($params, 'optimization_problem_id'); |
|
50 | + $param->reoptimize = self::getValue($params, 'reoptimize'); |
|
51 | + $param->redirect = filter_var(self::getValue($params, 'redirect', true), FILTER_VALIDATE_BOOLEAN); |
|
52 | 52 | |
53 | - return $param; |
|
54 | - } |
|
53 | + return $param; |
|
54 | + } |
|
55 | 55 | |
56 | - public function __construct() |
|
57 | - { |
|
58 | - $this->parameters = new RouteParameters; |
|
59 | - } |
|
56 | + public function __construct() |
|
57 | + { |
|
58 | + $this->parameters = new RouteParameters; |
|
59 | + } |
|
60 | 60 | |
61 | - public function setParameters(RouteParameters $params) |
|
62 | - { |
|
63 | - $this->parameters = $params; |
|
61 | + public function setParameters(RouteParameters $params) |
|
62 | + { |
|
63 | + $this->parameters = $params; |
|
64 | 64 | |
65 | - return $this; |
|
66 | - } |
|
65 | + return $this; |
|
66 | + } |
|
67 | 67 | |
68 | - public function addAddress(Address $address) |
|
69 | - { |
|
70 | - $this->addresses[] = $address; |
|
68 | + public function addAddress(Address $address) |
|
69 | + { |
|
70 | + $this->addresses[] = $address; |
|
71 | 71 | |
72 | - return $this; |
|
73 | - } |
|
72 | + return $this; |
|
73 | + } |
|
74 | 74 | |
75 | - public function getAddressesArray() |
|
76 | - { |
|
77 | - $addresses = array(); |
|
75 | + public function getAddressesArray() |
|
76 | + { |
|
77 | + $addresses = array(); |
|
78 | 78 | |
79 | - foreach($this->addresses as $address) { |
|
80 | - $addresses[] = $address->toArray(); |
|
81 | - } |
|
79 | + foreach($this->addresses as $address) { |
|
80 | + $addresses[] = $address->toArray(); |
|
81 | + } |
|
82 | 82 | |
83 | - return $addresses; |
|
84 | - } |
|
83 | + return $addresses; |
|
84 | + } |
|
85 | 85 | |
86 | - public function getParametersArray() |
|
87 | - { |
|
88 | - return $this->parameters->toArray(); |
|
89 | - } |
|
86 | + public function getParametersArray() |
|
87 | + { |
|
88 | + return $this->parameters->toArray(); |
|
89 | + } |
|
90 | 90 | |
91 | - public function setAddresses(array $addresses) |
|
92 | - { |
|
93 | - foreach ($addresses as $address) { |
|
94 | - $this->addAddress($address); |
|
95 | - } |
|
91 | + public function setAddresses(array $addresses) |
|
92 | + { |
|
93 | + foreach ($addresses as $address) { |
|
94 | + $this->addAddress($address); |
|
95 | + } |
|
96 | 96 | |
97 | - return $this; |
|
98 | - } |
|
97 | + return $this; |
|
98 | + } |
|
99 | 99 | } |
@@ -3,9 +3,9 @@ |
||
3 | 3 | |
4 | 4 | class myErrorHandler extends \Exception |
5 | 5 | { |
6 | - public function proc_error($errno, $errstr, $errfile, $errline) |
|
7 | - { |
|
8 | - echo "line: $errline --- ".$errstr."<br>"; |
|
6 | + public function proc_error($errno, $errstr, $errfile, $errline) |
|
7 | + { |
|
8 | + echo "line: $errline --- ".$errstr."<br>"; |
|
9 | 9 | |
10 | - } |
|
10 | + } |
|
11 | 11 | } |
@@ -3,9 +3,9 @@ |
||
3 | 3 | |
4 | 4 | class Metric |
5 | 5 | { |
6 | - const EUCLIDEAN = 1; //measures point to point distance as a straight line |
|
7 | - const MANHATTAN = 2; //measures point to point distance as taxicab geometry line |
|
8 | - const GEODESIC = 3; //measures point to point distance approximating curvature of the earth |
|
9 | - const MATRIX = 4; //measures point to point distance by traversing the actual road network |
|
10 | - const EXACT_2D = 5; //measures point to point distance using 2d rectilinear distance |
|
6 | + const EUCLIDEAN = 1; //measures point to point distance as a straight line |
|
7 | + const MANHATTAN = 2; //measures point to point distance as taxicab geometry line |
|
8 | + const GEODESIC = 3; //measures point to point distance approximating curvature of the earth |
|
9 | + const MATRIX = 4; //measures point to point distance by traversing the actual road network |
|
10 | + const EXACT_2D = 5; //measures point to point distance using 2d rectilinear distance |
|
11 | 11 | } |
@@ -3,34 +3,34 @@ |
||
3 | 3 | |
4 | 4 | class ActivityTypes |
5 | 5 | { |
6 | - const AREA_REMOVED = 'area-removed'; |
|
7 | - const AREA_ADDED = 'area-added'; |
|
8 | - const AREA_UPDATED = 'area-updated'; |
|
9 | - const DELETE_DESTINATION = 'delete-destination'; |
|
10 | - const INSERT_DESTINATION = 'insert-destination'; |
|
11 | - const DESTINATION_OUT_SEQUENCE = 'destination-out-sequence'; |
|
12 | - const DRIVER_ARRIVED_EARLY = 'driver-arrived-early'; |
|
13 | - const DRIVER_ARRIVED_LATE = 'driver-arrived-late'; |
|
14 | - const DRIVER_ARRIVED_ON_TIME = 'driver-arrived-on-time'; |
|
15 | - const GEOFENCE_LEFT = 'geofence-left'; |
|
16 | - const GEOFENCE_ENTERED = 'geofence-entered'; |
|
17 | - const MARK_DESTINATION_DEPARTED = 'mark-destination-departed'; |
|
18 | - const MARK_DESTINATION_VISITED = 'mark-destination-visited'; |
|
19 | - const MEMBER_CREATED = 'member-created'; |
|
20 | - const MEMBER_DELETED = 'member-deleted'; |
|
21 | - const MEMBER_MODIFIED = 'member-modified'; |
|
22 | - const MOVE_DESTINATION = 'move-destination'; |
|
23 | - const NOTE_INSERT = 'note-insert'; |
|
24 | - const ROUTE_DELETE = 'route-delete'; |
|
25 | - const ROUTE_OPTIMIZED = 'route-optimized'; |
|
26 | - const ROUTE_OWNER_CHANGED = 'route-owner-changed'; |
|
27 | - const ROUTE_DUPLICATE = 'route-duplicate'; |
|
28 | - const UPDATE_DESTINATIONS = 'update-destinations'; |
|
29 | - const USER_MESSAGE = 'user_message'; |
|
6 | + const AREA_REMOVED = 'area-removed'; |
|
7 | + const AREA_ADDED = 'area-added'; |
|
8 | + const AREA_UPDATED = 'area-updated'; |
|
9 | + const DELETE_DESTINATION = 'delete-destination'; |
|
10 | + const INSERT_DESTINATION = 'insert-destination'; |
|
11 | + const DESTINATION_OUT_SEQUENCE = 'destination-out-sequence'; |
|
12 | + const DRIVER_ARRIVED_EARLY = 'driver-arrived-early'; |
|
13 | + const DRIVER_ARRIVED_LATE = 'driver-arrived-late'; |
|
14 | + const DRIVER_ARRIVED_ON_TIME = 'driver-arrived-on-time'; |
|
15 | + const GEOFENCE_LEFT = 'geofence-left'; |
|
16 | + const GEOFENCE_ENTERED = 'geofence-entered'; |
|
17 | + const MARK_DESTINATION_DEPARTED = 'mark-destination-departed'; |
|
18 | + const MARK_DESTINATION_VISITED = 'mark-destination-visited'; |
|
19 | + const MEMBER_CREATED = 'member-created'; |
|
20 | + const MEMBER_DELETED = 'member-deleted'; |
|
21 | + const MEMBER_MODIFIED = 'member-modified'; |
|
22 | + const MOVE_DESTINATION = 'move-destination'; |
|
23 | + const NOTE_INSERT = 'note-insert'; |
|
24 | + const ROUTE_DELETE = 'route-delete'; |
|
25 | + const ROUTE_OPTIMIZED = 'route-optimized'; |
|
26 | + const ROUTE_OWNER_CHANGED = 'route-owner-changed'; |
|
27 | + const ROUTE_DUPLICATE = 'route-duplicate'; |
|
28 | + const UPDATE_DESTINATIONS = 'update-destinations'; |
|
29 | + const USER_MESSAGE = 'user_message'; |
|
30 | 30 | |
31 | - static function getConstants() { |
|
32 | - $atc = new \ReflectionClass('Route4Me\\Enum\\ActivityTypes'); |
|
33 | - return $atc->getConstants(); |
|
34 | - } |
|
31 | + static function getConstants() { |
|
32 | + $atc = new \ReflectionClass('Route4Me\\Enum\\ActivityTypes'); |
|
33 | + return $atc->getConstants(); |
|
34 | + } |
|
35 | 35 | } |
36 | 36 |