@@ -6,141 +6,141 @@ |
||
6 | 6 | |
7 | 7 | class Geocoding extends Common |
8 | 8 | { |
9 | - public $strExportFormat; |
|
10 | - public $format; |
|
11 | - public $addresses; |
|
12 | - public $pk; |
|
13 | - public $offset; |
|
14 | - public $limit; |
|
15 | - public $housenumber; |
|
16 | - public $zipcode; |
|
9 | + public $strExportFormat; |
|
10 | + public $format; |
|
11 | + public $addresses; |
|
12 | + public $pk; |
|
13 | + public $offset; |
|
14 | + public $limit; |
|
15 | + public $housenumber; |
|
16 | + public $zipcode; |
|
17 | 17 | |
18 | - public static function fromArray(array $params) |
|
19 | - { |
|
20 | - $geocoding = new Geocoding(); |
|
21 | - |
|
22 | - foreach($params as $key => $value) { |
|
23 | - if (property_exists($geocoding, $key)) { |
|
24 | - $geocoding->{$key} = $value; |
|
25 | - } |
|
26 | - } |
|
27 | - |
|
28 | - return $geocoding; |
|
29 | - } |
|
18 | + public static function fromArray(array $params) |
|
19 | + { |
|
20 | + $geocoding = new Geocoding(); |
|
21 | + |
|
22 | + foreach($params as $key => $value) { |
|
23 | + if (property_exists($geocoding, $key)) { |
|
24 | + $geocoding->{$key} = $value; |
|
25 | + } |
|
26 | + } |
|
27 | + |
|
28 | + return $geocoding; |
|
29 | + } |
|
30 | 30 | |
31 | - public static function forwardGeocoding($params) |
|
32 | - { |
|
33 | - $body = array( |
|
34 | - 'strExportFormat' => isset($params['strExportFormat']) ? $params['strExportFormat']: null, |
|
35 | - 'addresses' => isset($params['addresses']) ? $params['addresses'] : null, |
|
36 | - ); |
|
31 | + public static function forwardGeocoding($params) |
|
32 | + { |
|
33 | + $body = array( |
|
34 | + 'strExportFormat' => isset($params['strExportFormat']) ? $params['strExportFormat']: null, |
|
35 | + 'addresses' => isset($params['addresses']) ? $params['addresses'] : null, |
|
36 | + ); |
|
37 | 37 | |
38 | - $fgCoding = Route4Me::makeRequst(array( |
|
39 | - 'url' => Endpoint::GEOCODER, |
|
40 | - 'method' => 'POST', |
|
41 | - 'body' => $body, |
|
42 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
43 | - )); |
|
44 | - |
|
45 | - return $fgCoding; |
|
46 | - } |
|
38 | + $fgCoding = Route4Me::makeRequst(array( |
|
39 | + 'url' => Endpoint::GEOCODER, |
|
40 | + 'method' => 'POST', |
|
41 | + 'body' => $body, |
|
42 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
43 | + )); |
|
44 | + |
|
45 | + return $fgCoding; |
|
46 | + } |
|
47 | 47 | |
48 | - public static function reverseGeocoding($params) |
|
49 | - { |
|
50 | - $query = array( |
|
51 | - 'format' => isset($params['format']) ? $params['format']: null, |
|
52 | - 'addresses' => isset($params['addresses']) ? $params['addresses'] : null, |
|
53 | - 'detailed' => isset($params['detailed']) ? $params['detailed'] : null, |
|
54 | - ); |
|
48 | + public static function reverseGeocoding($params) |
|
49 | + { |
|
50 | + $query = array( |
|
51 | + 'format' => isset($params['format']) ? $params['format']: null, |
|
52 | + 'addresses' => isset($params['addresses']) ? $params['addresses'] : null, |
|
53 | + 'detailed' => isset($params['detailed']) ? $params['detailed'] : null, |
|
54 | + ); |
|
55 | 55 | |
56 | - $fgcoding = Route4Me::makeRequst(array( |
|
57 | - 'url' => Endpoint::GEOCODER, |
|
58 | - 'method' => 'POST', |
|
59 | - 'query' => $query |
|
60 | - )); |
|
61 | - |
|
62 | - return $fgcoding; |
|
63 | - } |
|
56 | + $fgcoding = Route4Me::makeRequst(array( |
|
57 | + 'url' => Endpoint::GEOCODER, |
|
58 | + 'method' => 'POST', |
|
59 | + 'query' => $query |
|
60 | + )); |
|
61 | + |
|
62 | + return $fgcoding; |
|
63 | + } |
|
64 | 64 | |
65 | - public static function getStreetData($params) |
|
66 | - { |
|
67 | - $url_query = Endpoint::STREET_DATA; |
|
65 | + public static function getStreetData($params) |
|
66 | + { |
|
67 | + $url_query = Endpoint::STREET_DATA; |
|
68 | 68 | |
69 | - if (isset($params['pk'])) { |
|
70 | - $url_query.=$params['pk'].'/'; |
|
71 | - } |
|
69 | + if (isset($params['pk'])) { |
|
70 | + $url_query.=$params['pk'].'/'; |
|
71 | + } |
|
72 | 72 | |
73 | - if (isset($params['offset'])) { |
|
74 | - $url_query.=$params['offset'].'/'; |
|
75 | - } |
|
73 | + if (isset($params['offset'])) { |
|
74 | + $url_query.=$params['offset'].'/'; |
|
75 | + } |
|
76 | 76 | |
77 | - if (isset($params['limit'])) { |
|
78 | - $url_query.=$params['limit'].'/'; |
|
79 | - } |
|
77 | + if (isset($params['limit'])) { |
|
78 | + $url_query.=$params['limit'].'/'; |
|
79 | + } |
|
80 | 80 | |
81 | - $query = array(); |
|
81 | + $query = array(); |
|
82 | 82 | |
83 | - $response = Route4Me::makeUrlRequst($url_query, array( |
|
84 | - 'method' => 'GET', |
|
85 | - 'query' => $query |
|
86 | - )); |
|
83 | + $response = Route4Me::makeUrlRequst($url_query, array( |
|
84 | + 'method' => 'GET', |
|
85 | + 'query' => $query |
|
86 | + )); |
|
87 | 87 | |
88 | - return $response; |
|
89 | - } |
|
88 | + return $response; |
|
89 | + } |
|
90 | 90 | |
91 | - public static function getZipCode($params) |
|
92 | - { |
|
93 | - $url_query = Endpoint::STREET_DATA_ZIPCODE; |
|
91 | + public static function getZipCode($params) |
|
92 | + { |
|
93 | + $url_query = Endpoint::STREET_DATA_ZIPCODE; |
|
94 | 94 | |
95 | - if (isset($params['zipcode'])) { |
|
96 | - $url_query.=$params['zipcode'].'/'; |
|
97 | - } |
|
95 | + if (isset($params['zipcode'])) { |
|
96 | + $url_query.=$params['zipcode'].'/'; |
|
97 | + } |
|
98 | 98 | |
99 | - if (isset($params['offset'])) { |
|
100 | - $url_query.=$params['offset'].'/'; |
|
101 | - } |
|
99 | + if (isset($params['offset'])) { |
|
100 | + $url_query.=$params['offset'].'/'; |
|
101 | + } |
|
102 | 102 | |
103 | - if (isset($params['limit'])) { |
|
104 | - $url_query.=$params['limit'].'/'; |
|
105 | - } |
|
103 | + if (isset($params['limit'])) { |
|
104 | + $url_query.=$params['limit'].'/'; |
|
105 | + } |
|
106 | 106 | |
107 | - $query = array(); |
|
107 | + $query = array(); |
|
108 | 108 | |
109 | - $response = Route4Me::makeUrlRequst($url_query, array( |
|
110 | - 'method' => 'GET', |
|
111 | - 'query' => $query |
|
112 | - )); |
|
109 | + $response = Route4Me::makeUrlRequst($url_query, array( |
|
110 | + 'method' => 'GET', |
|
111 | + 'query' => $query |
|
112 | + )); |
|
113 | 113 | |
114 | - return $response; |
|
115 | - } |
|
114 | + return $response; |
|
115 | + } |
|
116 | 116 | |
117 | - public static function getService($params) |
|
118 | - { |
|
119 | - $url_query = Endpoint::STREET_DATA_SERVICE; |
|
117 | + public static function getService($params) |
|
118 | + { |
|
119 | + $url_query = Endpoint::STREET_DATA_SERVICE; |
|
120 | 120 | |
121 | - if (isset($params['zipcode'])) { |
|
122 | - $url_query.=$params['zipcode'].'/'; |
|
123 | - } |
|
121 | + if (isset($params['zipcode'])) { |
|
122 | + $url_query.=$params['zipcode'].'/'; |
|
123 | + } |
|
124 | 124 | |
125 | - if (isset($params['housenumber'])) { |
|
126 | - $url_query.=$params['housenumber'].'/'; |
|
127 | - } |
|
125 | + if (isset($params['housenumber'])) { |
|
126 | + $url_query.=$params['housenumber'].'/'; |
|
127 | + } |
|
128 | 128 | |
129 | - if (isset($params['offset'])) { |
|
130 | - $url_query.=$params['offset'].'/'; |
|
131 | - } |
|
129 | + if (isset($params['offset'])) { |
|
130 | + $url_query.=$params['offset'].'/'; |
|
131 | + } |
|
132 | 132 | |
133 | - if (isset($params['limit'])) { |
|
134 | - $url_query.=$params['limit'].'/'; |
|
135 | - } |
|
133 | + if (isset($params['limit'])) { |
|
134 | + $url_query.=$params['limit'].'/'; |
|
135 | + } |
|
136 | 136 | |
137 | - $query = array(); |
|
137 | + $query = array(); |
|
138 | 138 | |
139 | - $response = Route4Me::makeUrlRequst($url_query, array( |
|
140 | - 'method' => 'GET', |
|
141 | - 'query' => $query |
|
142 | - )); |
|
139 | + $response = Route4Me::makeUrlRequst($url_query, array( |
|
140 | + 'method' => 'GET', |
|
141 | + 'query' => $query |
|
142 | + )); |
|
143 | 143 | |
144 | - return $response; |
|
145 | - } |
|
144 | + return $response; |
|
145 | + } |
|
146 | 146 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | $geocoding = new Geocoding(); |
21 | 21 | |
22 | - foreach($params as $key => $value) { |
|
22 | + foreach ($params as $key => $value) { |
|
23 | 23 | if (property_exists($geocoding, $key)) { |
24 | 24 | $geocoding->{$key} = $value; |
25 | 25 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public static function forwardGeocoding($params) |
32 | 32 | { |
33 | 33 | $body = array( |
34 | - 'strExportFormat' => isset($params['strExportFormat']) ? $params['strExportFormat']: null, |
|
34 | + 'strExportFormat' => isset($params['strExportFormat']) ? $params['strExportFormat'] : null, |
|
35 | 35 | 'addresses' => isset($params['addresses']) ? $params['addresses'] : null, |
36 | 36 | ); |
37 | 37 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | public static function reverseGeocoding($params) |
49 | 49 | { |
50 | 50 | $query = array( |
51 | - 'format' => isset($params['format']) ? $params['format']: null, |
|
51 | + 'format' => isset($params['format']) ? $params['format'] : null, |
|
52 | 52 | 'addresses' => isset($params['addresses']) ? $params['addresses'] : null, |
53 | 53 | 'detailed' => isset($params['detailed']) ? $params['detailed'] : null, |
54 | 54 | ); |
@@ -67,15 +67,15 @@ discard block |
||
67 | 67 | $url_query = Endpoint::STREET_DATA; |
68 | 68 | |
69 | 69 | if (isset($params['pk'])) { |
70 | - $url_query.=$params['pk'].'/'; |
|
70 | + $url_query .= $params['pk'].'/'; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | if (isset($params['offset'])) { |
74 | - $url_query.=$params['offset'].'/'; |
|
74 | + $url_query .= $params['offset'].'/'; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | if (isset($params['limit'])) { |
78 | - $url_query.=$params['limit'].'/'; |
|
78 | + $url_query .= $params['limit'].'/'; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | $query = array(); |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | $url_query = Endpoint::STREET_DATA_ZIPCODE; |
94 | 94 | |
95 | 95 | if (isset($params['zipcode'])) { |
96 | - $url_query.=$params['zipcode'].'/'; |
|
96 | + $url_query .= $params['zipcode'].'/'; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | if (isset($params['offset'])) { |
100 | - $url_query.=$params['offset'].'/'; |
|
100 | + $url_query .= $params['offset'].'/'; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | if (isset($params['limit'])) { |
104 | - $url_query.=$params['limit'].'/'; |
|
104 | + $url_query .= $params['limit'].'/'; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | $query = array(); |
@@ -119,19 +119,19 @@ discard block |
||
119 | 119 | $url_query = Endpoint::STREET_DATA_SERVICE; |
120 | 120 | |
121 | 121 | if (isset($params['zipcode'])) { |
122 | - $url_query.=$params['zipcode'].'/'; |
|
122 | + $url_query .= $params['zipcode'].'/'; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | if (isset($params['housenumber'])) { |
126 | - $url_query.=$params['housenumber'].'/'; |
|
126 | + $url_query .= $params['housenumber'].'/'; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | if (isset($params['offset'])) { |
130 | - $url_query.=$params['offset'].'/'; |
|
130 | + $url_query .= $params['offset'].'/'; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | if (isset($params['limit'])) { |
134 | - $url_query.=$params['limit'].'/'; |
|
134 | + $url_query .= $params['limit'].'/'; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | $query = array(); |
@@ -6,88 +6,88 @@ |
||
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 get($params) |
|
46 | - { |
|
47 | - $activity = Route4Me::makeRequst(array( |
|
48 | - 'url' => Endpoint::GET_ACTIVITIES, |
|
49 | - 'method' => 'GET', |
|
50 | - 'query' => array( |
|
51 | - 'route_id' => isset($params->route_id) ? $params->route_id : null, |
|
52 | - 'team' => isset($params->team) ? $params->team : null, |
|
53 | - 'limit' => isset($params->limit) ? $params->limit : null, |
|
54 | - 'offset' => isset($params->offset) ? $params->offset : null, |
|
55 | - 'start' => isset($params->start) ? $params->start : null, |
|
56 | - ) |
|
57 | - )); |
|
45 | + public static function get($params) |
|
46 | + { |
|
47 | + $activity = Route4Me::makeRequst(array( |
|
48 | + 'url' => Endpoint::GET_ACTIVITIES, |
|
49 | + 'method' => 'GET', |
|
50 | + 'query' => array( |
|
51 | + 'route_id' => isset($params->route_id) ? $params->route_id : null, |
|
52 | + 'team' => isset($params->team) ? $params->team : null, |
|
53 | + 'limit' => isset($params->limit) ? $params->limit : null, |
|
54 | + 'offset' => isset($params->offset) ? $params->offset : null, |
|
55 | + 'start' => isset($params->start) ? $params->start : null, |
|
56 | + ) |
|
57 | + )); |
|
58 | 58 | |
59 | - return $activity; |
|
60 | - } |
|
59 | + return $activity; |
|
60 | + } |
|
61 | 61 | |
62 | - public static function searcActivities($params) |
|
63 | - { |
|
64 | - $activity = Route4Me::makeRequst(array( |
|
65 | - 'url' => Endpoint::GET_ACTIVITIES, |
|
66 | - 'method' => 'GET', |
|
67 | - 'query' => array( |
|
68 | - 'route_id' => isset($params->route_id) ? $params->route_id : null, |
|
69 | - 'limit' => isset($params->limit) ? $params->limit : null, |
|
70 | - 'offset' => isset($params->offset) ? $params->offset : null, |
|
71 | - 'activity_type' => isset($params->activity_type) ? $params->activity_type : null, |
|
72 | - ) |
|
73 | - )); |
|
62 | + public static function searcActivities($params) |
|
63 | + { |
|
64 | + $activity = Route4Me::makeRequst(array( |
|
65 | + 'url' => Endpoint::GET_ACTIVITIES, |
|
66 | + 'method' => 'GET', |
|
67 | + 'query' => array( |
|
68 | + 'route_id' => isset($params->route_id) ? $params->route_id : null, |
|
69 | + 'limit' => isset($params->limit) ? $params->limit : null, |
|
70 | + 'offset' => isset($params->offset) ? $params->offset : null, |
|
71 | + 'activity_type' => isset($params->activity_type) ? $params->activity_type : null, |
|
72 | + ) |
|
73 | + )); |
|
74 | 74 | |
75 | - return $activity; |
|
76 | - } |
|
75 | + return $activity; |
|
76 | + } |
|
77 | 77 | |
78 | - public static function sendUserMessage($postParameters) |
|
79 | - { |
|
80 | - $result = Route4Me::makeRequst(array( |
|
81 | - 'url' => Endpoint::ACTIVITY_FEED, |
|
82 | - 'method' => 'POST', |
|
83 | - 'body' => array( |
|
84 | - 'activity_type' => isset($postParameters->activity_type) ? $postParameters->activity_type : null, |
|
85 | - 'activity_message' => isset($postParameters->activity_message) ? $postParameters->activity_message : null, |
|
86 | - 'route_id' => isset($postParameters->route_id) ? $postParameters->route_id : null, |
|
87 | - ) |
|
88 | - )); |
|
78 | + public static function sendUserMessage($postParameters) |
|
79 | + { |
|
80 | + $result = Route4Me::makeRequst(array( |
|
81 | + 'url' => Endpoint::ACTIVITY_FEED, |
|
82 | + 'method' => 'POST', |
|
83 | + 'body' => array( |
|
84 | + 'activity_type' => isset($postParameters->activity_type) ? $postParameters->activity_type : null, |
|
85 | + 'activity_message' => isset($postParameters->activity_message) ? $postParameters->activity_message : null, |
|
86 | + 'route_id' => isset($postParameters->route_id) ? $postParameters->route_id : null, |
|
87 | + ) |
|
88 | + )); |
|
89 | 89 | |
90 | - return $result; |
|
91 | - } |
|
90 | + return $result; |
|
91 | + } |
|
92 | 92 | |
93 | 93 | } |
@@ -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 | } |
@@ -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 | } |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | |
70 | 70 | public static function addTerritory($params) |
71 | 71 | { |
72 | - $terParams = array(); |
|
72 | + $terParams = array(); |
|
73 | 73 | |
74 | - if (isset($params->territory['type'])) $terParams['type'] = $params->territory['type']; |
|
75 | - if (isset($params->territory['data'])) $terParams['data'] = $params->territory['data']; |
|
74 | + if (isset($params->territory['type'])) $terParams['type'] = $params->territory['type']; |
|
75 | + if (isset($params->territory['data'])) $terParams['data'] = $params->territory['data']; |
|
76 | 76 | |
77 | 77 | $response = Route4Me::makeRequst(array( |
78 | 78 | 'url' => Endpoint::TERRITORY_V4, |
@@ -102,19 +102,19 @@ discard block |
||
102 | 102 | |
103 | 103 | public function updateTerritory($params) |
104 | 104 | { |
105 | - //var_dump($params); die(""); |
|
105 | + //var_dump($params); die(""); |
|
106 | 106 | $response = Route4Me::makeRequst(array( |
107 | 107 | 'url' => Endpoint::TERRITORY_V4, |
108 | 108 | 'method' => 'PUT', |
109 | 109 | 'query' => array( |
110 | - 'territory_id' => isset($params->territory_id) ? $params->territory_id : null |
|
111 | - ), |
|
112 | - 'body' => array( |
|
113 | - 'territory_name' => isset($params->territory_name) ? $params->territory_name : null, |
|
114 | - 'member_id' => isset($params->member_id) ? $params->member_id : null, |
|
115 | - 'territory_color' => isset($params->territory_color) ? $params->territory_color : null, |
|
116 | - 'territory' => isset($params->territory) ? $params->territory : null |
|
117 | - ) |
|
110 | + 'territory_id' => isset($params->territory_id) ? $params->territory_id : null |
|
111 | + ), |
|
112 | + 'body' => array( |
|
113 | + 'territory_name' => isset($params->territory_name) ? $params->territory_name : null, |
|
114 | + 'member_id' => isset($params->member_id) ? $params->member_id : null, |
|
115 | + 'territory_color' => isset($params->territory_color) ? $params->territory_color : null, |
|
116 | + 'territory' => isset($params->territory) ? $params->territory : null |
|
117 | + ) |
|
118 | 118 | |
119 | 119 | )); |
120 | 120 |
@@ -71,8 +71,12 @@ |
||
71 | 71 | { |
72 | 72 | $terParams = array(); |
73 | 73 | |
74 | - if (isset($params->territory['type'])) $terParams['type'] = $params->territory['type']; |
|
75 | - if (isset($params->territory['data'])) $terParams['data'] = $params->territory['data']; |
|
74 | + if (isset($params->territory['type'])) { |
|
75 | + $terParams['type'] = $params->territory['type']; |
|
76 | + } |
|
77 | + if (isset($params->territory['data'])) { |
|
78 | + $terParams['data'] = $params->territory['data']; |
|
79 | + } |
|
76 | 80 | |
77 | 81 | $response = Route4Me::makeRequst(array( |
78 | 82 | 'url' => Endpoint::TERRITORY_V4, |
@@ -4,17 +4,17 @@ |
||
4 | 4 | |
5 | 5 | class Common |
6 | 6 | { |
7 | - public static function getValue($array, $item, $default = null) |
|
8 | - { |
|
9 | - return (isset($array[$item])) ? $array[$item] : $default; |
|
10 | - } |
|
7 | + public static function getValue($array, $item, $default = null) |
|
8 | + { |
|
9 | + return (isset($array[$item])) ? $array[$item] : $default; |
|
10 | + } |
|
11 | 11 | |
12 | - public function toArray() |
|
13 | - { |
|
14 | - $params = array_filter(get_object_vars($this), function($item) { |
|
15 | - return ($item !== null) && !(is_array($item) && !count($item)); |
|
16 | - }); |
|
12 | + public function toArray() |
|
13 | + { |
|
14 | + $params = array_filter(get_object_vars($this), function($item) { |
|
15 | + return ($item !== null) && !(is_array($item) && !count($item)); |
|
16 | + }); |
|
17 | 17 | |
18 | - return $params; |
|
19 | - } |
|
18 | + return $params; |
|
19 | + } |
|
20 | 20 | } |
@@ -7,94 +7,94 @@ |
||
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( |
|
52 | - 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( |
|
52 | + self::getValue($params, 'redirect', true), FILTER_VALIDATE_BOOLEAN); |
|
53 | 53 | |
54 | - return $param; |
|
55 | - } |
|
54 | + return $param; |
|
55 | + } |
|
56 | 56 | |
57 | - public function __construct() |
|
58 | - { |
|
59 | - $this->parameters = new RouteParameters; |
|
60 | - } |
|
57 | + public function __construct() |
|
58 | + { |
|
59 | + $this->parameters = new RouteParameters; |
|
60 | + } |
|
61 | 61 | |
62 | - public function setParameters(RouteParameters $params) |
|
63 | - { |
|
64 | - $this->parameters = $params; |
|
62 | + public function setParameters(RouteParameters $params) |
|
63 | + { |
|
64 | + $this->parameters = $params; |
|
65 | 65 | |
66 | - return $this; |
|
67 | - } |
|
66 | + return $this; |
|
67 | + } |
|
68 | 68 | |
69 | - public function addAddress(Address $address) |
|
70 | - { |
|
71 | - $this->addresses[] = $address; |
|
69 | + public function addAddress(Address $address) |
|
70 | + { |
|
71 | + $this->addresses[] = $address; |
|
72 | 72 | |
73 | - return $this; |
|
74 | - } |
|
73 | + return $this; |
|
74 | + } |
|
75 | 75 | |
76 | - public function getAddressesArray() |
|
77 | - { |
|
78 | - $addresses = array(); |
|
76 | + public function getAddressesArray() |
|
77 | + { |
|
78 | + $addresses = array(); |
|
79 | 79 | |
80 | - foreach($this->addresses as $address) { |
|
81 | - $addresses[] = $address->toArray(); |
|
82 | - } |
|
80 | + foreach($this->addresses as $address) { |
|
81 | + $addresses[] = $address->toArray(); |
|
82 | + } |
|
83 | 83 | |
84 | - return $addresses; |
|
85 | - } |
|
84 | + return $addresses; |
|
85 | + } |
|
86 | 86 | |
87 | - public function getParametersArray() |
|
88 | - { |
|
89 | - return $this->parameters->toArray(); |
|
90 | - } |
|
87 | + public function getParametersArray() |
|
88 | + { |
|
89 | + return $this->parameters->toArray(); |
|
90 | + } |
|
91 | 91 | |
92 | - public function setAddresses(array $addresses) |
|
93 | - { |
|
94 | - foreach ($addresses as $address) { |
|
95 | - $this->addAddress($address); |
|
96 | - } |
|
92 | + public function setAddresses(array $addresses) |
|
93 | + { |
|
94 | + foreach ($addresses as $address) { |
|
95 | + $this->addAddress($address); |
|
96 | + } |
|
97 | 97 | |
98 | - return $this; |
|
99 | - } |
|
98 | + return $this; |
|
99 | + } |
|
100 | 100 | } |
@@ -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 |
@@ -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 | } |
@@ -5,74 +5,74 @@ |
||
5 | 5 | |
6 | 6 | class RouteParameters extends Common |
7 | 7 | { |
8 | - public $is_upload; |
|
9 | - public $rt; |
|
10 | - public $route_name; |
|
11 | - public $route_date; |
|
12 | - public $route_time; |
|
13 | - public $shared_publicly; |
|
14 | - public $disable_optimization; |
|
15 | - public $optimize; |
|
16 | - public $lock_last; |
|
17 | - public $vehicle_capacity; |
|
18 | - public $vehicle_max_distance_mi; |
|
19 | - public $distance_unit; |
|
20 | - public $travel_mode; |
|
21 | - public $avoid; |
|
22 | - public $vehicle_id; |
|
23 | - public $dev_lat; |
|
24 | - public $dev_lng; |
|
25 | - public $route_max_duration; |
|
26 | - public $route_email; |
|
27 | - public $route_type = "api"; |
|
28 | - public $store_route = true; |
|
29 | - public $metric; |
|
30 | - public $algorithm_type; |
|
31 | - public $member_id; |
|
32 | - public $ip; |
|
33 | - public $dm; |
|
34 | - public $dirm; |
|
35 | - public $parts; |
|
36 | - public $device_id; |
|
37 | - public $device_type; |
|
38 | - public $has_trailer; |
|
39 | - public $trailer_weight_t; |
|
40 | - public $limited_weight_t; |
|
41 | - public $weight_per_axle_t; |
|
42 | - public $truck_height_meters; |
|
43 | - public $truck_width_meters; |
|
44 | - public $truck_length_meters; |
|
45 | - public $truck_hazardous_goods; |
|
8 | + public $is_upload; |
|
9 | + public $rt; |
|
10 | + public $route_name; |
|
11 | + public $route_date; |
|
12 | + public $route_time; |
|
13 | + public $shared_publicly; |
|
14 | + public $disable_optimization; |
|
15 | + public $optimize; |
|
16 | + public $lock_last; |
|
17 | + public $vehicle_capacity; |
|
18 | + public $vehicle_max_distance_mi; |
|
19 | + public $distance_unit; |
|
20 | + public $travel_mode; |
|
21 | + public $avoid; |
|
22 | + public $vehicle_id; |
|
23 | + public $dev_lat; |
|
24 | + public $dev_lng; |
|
25 | + public $route_max_duration; |
|
26 | + public $route_email; |
|
27 | + public $route_type = "api"; |
|
28 | + public $store_route = true; |
|
29 | + public $metric; |
|
30 | + public $algorithm_type; |
|
31 | + public $member_id; |
|
32 | + public $ip; |
|
33 | + public $dm; |
|
34 | + public $dirm; |
|
35 | + public $parts; |
|
36 | + public $device_id; |
|
37 | + public $device_type; |
|
38 | + public $has_trailer; |
|
39 | + public $trailer_weight_t; |
|
40 | + public $limited_weight_t; |
|
41 | + public $weight_per_axle_t; |
|
42 | + public $truck_height_meters; |
|
43 | + public $truck_width_meters; |
|
44 | + public $truck_length_meters; |
|
45 | + public $truck_hazardous_goods; |
|
46 | 46 | |
47 | - public $vehicle_max_cargo_weight; |
|
48 | - public $vehicle_max_cargo_volume; |
|
49 | - public $subtour_max_revenue; |
|
50 | - public $avoidance_zones; |
|
51 | - public $driver_id; |
|
52 | - public $parts_min; |
|
53 | - public $first_drive_then_wait_between_stops; |
|
54 | - public $truck_height; |
|
55 | - public $truck_width; |
|
56 | - public $truck_length; |
|
57 | - public $optimization_quality; |
|
58 | - public $override_addresses; |
|
59 | - public $max_tour_size; |
|
60 | - public $min_tour_size; |
|
61 | - public $uturn; |
|
62 | - public $leftturn; |
|
63 | - public $rightturn; |
|
47 | + public $vehicle_max_cargo_weight; |
|
48 | + public $vehicle_max_cargo_volume; |
|
49 | + public $subtour_max_revenue; |
|
50 | + public $avoidance_zones; |
|
51 | + public $driver_id; |
|
52 | + public $parts_min; |
|
53 | + public $first_drive_then_wait_between_stops; |
|
54 | + public $truck_height; |
|
55 | + public $truck_width; |
|
56 | + public $truck_length; |
|
57 | + public $optimization_quality; |
|
58 | + public $override_addresses; |
|
59 | + public $max_tour_size; |
|
60 | + public $min_tour_size; |
|
61 | + public $uturn; |
|
62 | + public $leftturn; |
|
63 | + public $rightturn; |
|
64 | 64 | |
65 | - public $optimized_callback_url; |
|
65 | + public $optimized_callback_url; |
|
66 | 66 | |
67 | - public static function fromArray(array $params) |
|
68 | - { |
|
69 | - $routeParams = new RouteParameters(); |
|
70 | - foreach($params as $key => $value) { |
|
71 | - if (property_exists($routeParams, $key)) { |
|
72 | - $routeParams->{$key} = $value; |
|
73 | - } |
|
74 | - } |
|
67 | + public static function fromArray(array $params) |
|
68 | + { |
|
69 | + $routeParams = new RouteParameters(); |
|
70 | + foreach($params as $key => $value) { |
|
71 | + if (property_exists($routeParams, $key)) { |
|
72 | + $routeParams->{$key} = $value; |
|
73 | + } |
|
74 | + } |
|
75 | 75 | |
76 | - return $routeParams; |
|
77 | - } |
|
76 | + return $routeParams; |
|
77 | + } |
|
78 | 78 | } |
@@ -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 |