1
|
|
|
<?php |
2
|
|
|
namespace Route4Me; |
3
|
|
|
|
4
|
|
|
use Route4Me\Common; |
5
|
|
|
use Route4Me\Address; |
6
|
|
|
use Route4Me\RouteParameters; |
7
|
|
|
use Route4Me\Route4Me; |
8
|
|
|
use Route4Me\Enum\Endpoint; |
9
|
|
|
|
10
|
|
|
class Route extends Common |
11
|
|
|
{ |
12
|
|
|
public $route_id; |
13
|
|
|
public $member_id; |
14
|
|
|
public $route_destination_id; |
15
|
|
|
public $optimization_problem_id; |
16
|
|
|
public $vehicle_alias; |
17
|
|
|
public $driver_alias; |
18
|
|
|
public $trip_distance; |
19
|
|
|
public $mpg; |
20
|
|
|
public $gas_price; |
21
|
|
|
public $route_duration_sec; |
22
|
|
|
public $destination_count; |
23
|
|
|
public $parameters; |
24
|
|
|
public $addresses = array(); |
25
|
|
|
public $links = array(); |
26
|
|
|
public $directions = array(); |
27
|
|
|
public $path = array(); |
28
|
|
|
public $tracking_history = array(); |
29
|
|
|
public $recipient_email; |
30
|
|
|
public $httpheaders; |
31
|
|
|
public $is_unrouted; |
32
|
|
|
public $time; |
33
|
|
|
|
34
|
|
|
public $dev_lat; |
35
|
|
|
public $dev_lng; |
36
|
|
|
|
37
|
|
|
public $user_route_rating; |
38
|
|
|
public $member_email; |
39
|
|
|
public $member_first_name; |
40
|
|
|
public $member_last_name; |
41
|
|
|
public $channel_name; |
42
|
|
|
public $route_cost; |
43
|
|
|
public $route_revenue; |
44
|
|
|
public $net_revenue_per_distance_unit; |
45
|
|
|
public $created_timestamp; |
46
|
|
|
public $planned_total_route_duration; |
47
|
|
|
public $actual_travel_distance; |
48
|
|
|
public $actual_travel_time; |
49
|
|
|
public $actual_footsteps; |
50
|
|
|
public $working_time; |
51
|
|
|
public $driving_time; |
52
|
|
|
public $idling_time; |
53
|
|
|
public $paying_miles; |
54
|
|
|
public $geofence_polygon_type; |
55
|
|
|
public $geofence_polygon_size; |
56
|
|
|
public $notes; |
57
|
|
|
public $member_config_storage; |
58
|
|
|
|
59
|
|
|
public static function fromArray(array $params) |
60
|
|
|
{ |
61
|
|
|
$route = new Route(); |
62
|
|
|
$route->route_id = Common::getValue($params, 'route_id'); |
63
|
|
|
$route->member_id = Common::getValue($params, 'member_id'); |
64
|
|
|
$route->optimization_problem_id = Common::getValue($params, 'optimization_problem_id'); |
65
|
|
|
$route->vehicle_alias = Common::getValue($params, 'vehicle_alias'); |
66
|
|
|
$route->driver_alias = Common::getValue($params, 'driver_alias'); |
67
|
|
|
$route->trip_distance = Common::getValue($params, 'trip_distance'); |
68
|
|
|
$route->mpg = Common::getValue($params, 'mpg'); |
69
|
|
|
$route->gas_price = Common::getValue($params, 'gas_price'); |
70
|
|
|
$route->route_duration_sec = Common::getvalue($params, 'route_duration_sec'); |
71
|
|
|
$route->destination_count = Common::getvalue($params, 'destination_count'); |
72
|
|
|
$route->is_unrouted = Common::getvalue($params, 'is_unrouted'); |
73
|
|
|
|
74
|
|
|
// Make RouteParameters |
75
|
|
|
if (isset($params['parameters'])) { |
76
|
|
|
$route->parameters = RouteParameters::fromArray($params['parameters']); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
View Code Duplication |
if (isset($params['addresses'])) { |
|
|
|
|
80
|
|
|
$addresses = array(); |
81
|
|
|
foreach ($params['addresses'] as $address) { |
82
|
|
|
$addresses[] = Address::fromArray($address); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
$route->addresses = $addresses; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
$route->links = Common::getValue($params, 'links', array()); |
89
|
|
|
$route->directions = Common::getValue($params, 'directions', array()); |
90
|
|
|
$route->path = Common::getValue($params, 'path', array()); |
91
|
|
|
$route->tracking_history = Common::getValue($params, 'tracking_history', array()); |
92
|
|
|
|
93
|
|
|
return $route; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
public static function getRoutes($routeId = null, $params = null) |
97
|
|
|
{ |
98
|
|
|
$result = Route4Me::makeRequst(array( |
99
|
|
|
'url' => Endpoint::ROUTE_V4, |
100
|
|
|
'method' => 'GET', |
101
|
|
|
'query' => array( |
102
|
|
|
'api_key' => Route4Me::getApiKey(), |
103
|
|
|
'route_id' => !is_null($routeId) ? implode(',', (array)$routeId) : null, |
104
|
|
|
'route_path_output' => isset($params['route_path_output']) ? $params['route_path_output'] : null, |
105
|
|
|
'query' => isset($params['query']) ? $params['query'] : null, |
106
|
|
|
'directions' => isset($params['directions']) ? $params['directions'] : null, |
107
|
|
|
'device_tracking_history' => isset($params['device_tracking_history']) ? $params['device_tracking_history'] : null, |
108
|
|
|
'limit' => isset($params['limit']) ? $params['limit'] : null, |
109
|
|
|
'offset' => isset($params['offset']) ? $params['offset'] : null |
110
|
|
|
) |
111
|
|
|
)); |
112
|
|
|
|
113
|
|
|
if ($routeId) { |
114
|
|
|
return Route::fromArray($result); die(""); |
|
|
|
|
115
|
|
|
} else { |
116
|
|
|
$routes = array(); |
117
|
|
|
foreach ($result as $route) { |
118
|
|
|
$routes[] = Route::fromArray($route); |
119
|
|
|
} |
120
|
|
|
return $routes; |
121
|
|
|
} |
122
|
|
|
} |
123
|
|
|
|
124
|
|
View Code Duplication |
public function getRoutePoints($routeId, $params) |
|
|
|
|
125
|
|
|
{ |
126
|
|
|
$result = Route4Me::makeRequst(array( |
127
|
|
|
'url' => Endpoint::ROUTE_V4, |
128
|
|
|
'method' => 'GET', |
129
|
|
|
'query' => array( |
130
|
|
|
'api_key' => Route4Me::getApiKey(), |
131
|
|
|
'route_id' => $routeId, |
132
|
|
|
'route_path_output' => isset($params['route_path_output']) ? $params['route_path_output'] : null, |
133
|
|
|
'compress_path_points' => isset($params['compress_path_points']) ? $params['compress_path_points'] : null, |
134
|
|
|
'directions' => isset($params['directions']) ? $params['directions'] : null, |
135
|
|
|
) |
136
|
|
|
)); |
137
|
|
|
|
138
|
|
|
return $result; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
View Code Duplication |
public function duplicateRoute($route_id) |
|
|
|
|
142
|
|
|
{ |
143
|
|
|
$result = Route4Me::makeRequst(array( |
144
|
|
|
'url' => Endpoint::ROUTE_DUPLICATE, |
145
|
|
|
'method' => 'GET', |
146
|
|
|
'query' => array( |
147
|
|
|
'api_key' => Route4Me::getApiKey(), |
148
|
|
|
'route_id' => $route_id, |
149
|
|
|
'to' => 'none', |
150
|
|
|
) |
151
|
|
|
)); |
152
|
|
|
|
153
|
|
|
return $result; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
View Code Duplication |
public function resequenceRoute($params) |
|
|
|
|
157
|
|
|
{ |
158
|
|
|
$result = Route4Me::makeRequst(array( |
159
|
|
|
'url' => Endpoint::ROUTE_V4, |
160
|
|
|
'method' => 'PUT', |
161
|
|
|
'query' => array( |
162
|
|
|
'api_key' => Route4Me::getApiKey(), |
163
|
|
|
'route_id' => isset($params['route_id']) ? $params['route_id'] : null, |
164
|
|
|
'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null, |
165
|
|
|
), |
166
|
|
|
'body' => array( |
167
|
|
|
'addresses' => isset($params['addresses']) ? $params['addresses'] : null, |
168
|
|
|
) |
169
|
|
|
)); |
170
|
|
|
|
171
|
|
|
return $result; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
View Code Duplication |
public function resequenceAllAddresses($params) |
|
|
|
|
175
|
|
|
{ |
176
|
|
|
$result = Route4Me::makeRequst(array( |
177
|
|
|
'url' => Endpoint::REOPTIMIZE_V3_2, |
178
|
|
|
'method' => 'GET', |
179
|
|
|
'query' => array( |
180
|
|
|
'api_key' => Route4Me::getApiKey(), |
181
|
|
|
'route_id' => isset($params['route_id']) ? $params['route_id'] : null, |
182
|
|
|
'disable_optimization' => isset($params['disable_optimization']) ? $params['disable_optimization'] : null, |
183
|
|
|
'optimize' => isset($params['optimize']) ? $params['optimize'] : null, |
184
|
|
|
) |
185
|
|
|
)); |
186
|
|
|
|
187
|
|
|
return $result; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
public function mergeRoutes($params) |
191
|
|
|
{ |
192
|
|
|
$result = Route4Me::makeRequst(array( |
193
|
|
|
'url' => Endpoint::ROUTES_MERGE, |
194
|
|
|
'method' => 'POST', |
195
|
|
|
'query' => array( |
196
|
|
|
'api_key' => Route4Me::getApiKey(), |
197
|
|
|
), |
198
|
|
|
'body' => array( |
199
|
|
|
'route_ids' => isset($params['route_ids']) ? $params['route_ids'] : null, |
200
|
|
|
'depot_address' => isset($params['depot_address']) ? $params['depot_address'] : null, |
201
|
|
|
'remove_origin' => isset($params['remove_origin']) ? $params['remove_origin'] : null, |
202
|
|
|
'depot_lat' => isset($params['depot_lat']) ? $params['depot_lat'] : null, |
203
|
|
|
'depot_lat' => isset($params['depot_lat']) ? $params['depot_lat'] : null |
204
|
|
|
), |
205
|
|
|
'HTTPHEADER' => 'Content-Type: multipart/form-data' |
206
|
|
|
)); |
207
|
|
|
|
208
|
|
|
return $result; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
View Code Duplication |
public function shareRoute($params) |
|
|
|
|
212
|
|
|
{ |
213
|
|
|
$result = Route4Me::makeRequst(array( |
214
|
|
|
'url' => Endpoint::ROUTE_SHARE, |
215
|
|
|
'method' => 'POST', |
216
|
|
|
'query' => array( |
217
|
|
|
'api_key' => Route4Me::getApiKey(), |
218
|
|
|
'route_id' => isset($params['route_id']) ? $params['route_id'] : null, |
219
|
|
|
'response_format' => isset($params['response_format']) ? $params['response_format'] : null, |
220
|
|
|
), |
221
|
|
|
'body' => array( |
222
|
|
|
'recipient_email' => isset($params['recipient_email']) ? $params['recipient_email'] : null, |
223
|
|
|
), |
224
|
|
|
'HTTPHEADER' => 'Content-Type: multipart/form-data' |
225
|
|
|
)); |
226
|
|
|
|
227
|
|
|
return $result; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
// Returns random route_id from existing routes between $offset and $offset+$limit |
231
|
|
|
public function getRandomRouteId($offset, $limit) |
232
|
|
|
{ |
233
|
|
|
$query['limit'] = !is_null($limit) ? $limit : 30; |
|
|
|
|
234
|
|
|
$query['offset'] = !is_null($offset) ? $offset : 0; |
235
|
|
|
|
236
|
|
|
$json = Route4Me::makeRequst(array( |
237
|
|
|
'url' => Endpoint::ROUTE_V4, |
238
|
|
|
'method' => 'GET', |
239
|
|
|
'query' => $query |
240
|
|
|
)); |
241
|
|
|
|
242
|
|
|
if (sizeof($json)>0) { |
243
|
|
|
$routes = array(); |
244
|
|
|
|
245
|
|
|
foreach ($json as $route) { |
246
|
|
|
$routes[] = Route::fromArray($route); |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
$num = rand(0, sizeof($routes) - 1); |
250
|
|
|
$rRoute = (array)$routes[$num]; |
251
|
|
|
|
252
|
|
|
if (is_array($rRoute)) { |
253
|
|
|
return $rRoute["route_id"]; |
254
|
|
|
} else { |
255
|
|
|
return null; |
256
|
|
|
} |
257
|
|
|
} else { |
258
|
|
|
echo "<br> There are no routes in the account. Please, create the routes first. <br>"; |
259
|
|
|
return null; |
260
|
|
|
} |
261
|
|
|
} |
262
|
|
|
|
263
|
|
|
public function update() |
264
|
|
|
{ |
265
|
|
|
$route = Route4Me::makeRequst(array( |
266
|
|
|
'url' => Endpoint::ROUTE_V4, |
267
|
|
|
'method' => 'PUT', |
268
|
|
|
'query' => array( |
269
|
|
|
'route_id' => isset($this->route_id) ? $this->route_id : null |
270
|
|
|
), |
271
|
|
|
'body' => array( |
272
|
|
|
'parameters' => $this->parameters, |
273
|
|
|
), |
274
|
|
|
'HTTPHEADER' => isset($this->httpheaders) ? $this->httpheaders : null, |
275
|
|
|
)); |
276
|
|
|
|
277
|
|
|
return Route::fromArray($route); |
278
|
|
|
} |
279
|
|
|
|
280
|
|
|
public function updateAddress($address = null) |
|
|
|
|
281
|
|
|
{ |
282
|
|
|
$body = sizeof($this->addresses)<1 ? get_object_vars($this->parameters) |
283
|
|
|
: (isset($this->addresses[0]) ? $this->addresses[0] : get_object_vars($this->parameters)); |
284
|
|
|
|
285
|
|
|
$result = Route4Me::makeRequst(array( |
286
|
|
|
'url' => Endpoint::ADDRESS_V4, |
287
|
|
|
'method' => 'PUT', |
288
|
|
|
'query' => array( |
289
|
|
|
'route_id' => isset($this->route_id) ? $this->route_id : null, |
290
|
|
|
'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null, |
291
|
|
|
), |
292
|
|
|
'body' => $body, |
293
|
|
|
'HTTPHEADER' => isset($this->httpheaders) ? $this->httpheaders : null, |
294
|
|
|
)); |
295
|
|
|
|
296
|
|
|
return $result; |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
public function updateRouteAddress() |
300
|
|
|
{ |
301
|
|
|
$result = Route4Me::makeRequst(array( |
302
|
|
|
'url' => Endpoint::ADDRESS_V4, |
303
|
|
|
'method' => 'PUT', |
304
|
|
|
'query' => array( |
305
|
|
|
'route_id' => isset($this->route_id) ? $this->route_id : null, |
306
|
|
|
'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null, |
307
|
|
|
), |
308
|
|
|
'body' => array( |
309
|
|
|
"parameters" => isset($this->parameters) ? get_object_vars($this->parameters) : null, |
310
|
|
|
"addresses" => isset($this->addresses) ? $this->addresses : null |
311
|
|
|
), |
312
|
|
|
'HTTPHEADER' => isset($this->httpheaders) ? $this->httpheaders : null, |
313
|
|
|
)); |
314
|
|
|
|
315
|
|
|
return $result; |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
public function addAddresses($params) |
319
|
|
|
{ |
320
|
|
|
$route = Route4Me::makeRequst(array( |
321
|
|
|
'url' => Endpoint::ROUTE_V4, |
322
|
|
|
'method' => 'PUT', |
323
|
|
|
'query' => array( |
324
|
|
|
'api_key' => Route4Me::getApiKey(), |
325
|
|
|
'route_id' => isset($params['route_id']) ? $params['route_id'] : null |
326
|
|
|
), |
327
|
|
|
'body' => array( |
328
|
|
|
'addresses' => isset($params['addresses']) ? $params['addresses'] : null |
329
|
|
|
), |
330
|
|
|
'HTTPHEADER' => isset($this->httpheaders) ? $this->httpheaders : null, |
331
|
|
|
)); |
332
|
|
|
|
333
|
|
|
return Route::fromArray($route); |
334
|
|
|
} |
335
|
|
|
|
336
|
|
View Code Duplication |
public function insertAddressOptimalPosition(array $params) |
|
|
|
|
337
|
|
|
{ |
338
|
|
|
$route = Route4Me::makeRequst(array( |
339
|
|
|
'url' => Endpoint::ROUTE_V4, |
340
|
|
|
'method' => 'PUT', |
341
|
|
|
'query' => array( |
342
|
|
|
'api_key' => Route4Me::getApiKey(), |
343
|
|
|
'route_id' => isset($params['route_id']) ? $params['route_id'] : null, |
344
|
|
|
), |
345
|
|
|
'body' => array( |
346
|
|
|
'addresses' => isset($params['addresses']) ? $params['addresses'] : null, |
347
|
|
|
'optimal_position' => isset($params['optimal_position']) ? $params['optimal_position'] : null, |
348
|
|
|
) |
349
|
|
|
)); |
350
|
|
|
|
351
|
|
|
return Route::fromArray($route); |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
public function addNoteFile($params) |
355
|
|
|
{ |
356
|
|
|
$fname = isset($params['strFilename']) ? $params['strFilename'] : null; |
357
|
|
|
$rpath = realpath($fname); |
358
|
|
|
|
359
|
|
|
$result = Route4Me::makeRequst(array( |
360
|
|
|
'url' => Endpoint::ROUTE_NOTES_ADD, |
361
|
|
|
'method' => 'POST', |
362
|
|
|
'query' => array( |
363
|
|
|
'api_key' => Route4Me::getApiKey(), |
364
|
|
|
'route_id' => isset($params['route_id']) ? $params['route_id'] : null, |
365
|
|
|
'address_id' => isset($params['address_id']) ? $params['address_id'] : null, |
366
|
|
|
'dev_lat' => isset($params['dev_lat']) ? $params['dev_lat'] : null, |
367
|
|
|
'dev_lng' => isset($params['dev_lng']) ? $params['dev_lng'] : null, |
368
|
|
|
'device_type' => isset($params['device_type']) ? $params['device_type'] : null, |
369
|
|
|
'dev_lng' => isset($params['dev_lng']) ? $params['dev_lng'] : null, |
370
|
|
|
), |
371
|
|
|
'body' => array( |
372
|
|
|
'strUpdateType' => isset($params['strUpdateType']) ? $params['strUpdateType'] : null, |
373
|
|
|
'strFilename' => isset($params['strFilename']) ? $params['strFilename'] : null, |
374
|
|
|
'strNoteContents' => isset($params['strNoteContents']) ? $params['strNoteContents'] : null, |
375
|
|
|
), |
376
|
|
|
'FILE' => $rpath, |
377
|
|
|
|
378
|
|
|
'HTTPHEADER' => array( |
379
|
|
|
'Content-Type: application/x-www-form-urlencoded' |
380
|
|
|
) |
381
|
|
|
)); |
382
|
|
|
|
383
|
|
|
return $result; |
384
|
|
|
} |
385
|
|
|
|
386
|
|
|
public function delete($route_id) |
387
|
|
|
{ |
388
|
|
|
$result = Route4Me::makeRequst(array( |
|
|
|
|
389
|
|
|
'url' => Endpoint::ROUTE_V4, |
390
|
|
|
'method' => 'DELETE', |
391
|
|
|
'query' => array('route_id' => $route_id ) |
392
|
|
|
)); |
393
|
|
|
|
394
|
|
|
$result = Route4Me::makeRequst(array( |
395
|
|
|
'url' => Endpoint::ROUTES_DELETE, |
396
|
|
|
'method' => 'DELETE', |
397
|
|
|
'query' => array( |
398
|
|
|
'api_key' => Route4Me::getApiKey(), |
399
|
|
|
'route_id' => $route_id, |
400
|
|
|
) |
401
|
|
|
)); |
402
|
|
|
|
403
|
|
|
return $result; |
404
|
|
|
} |
405
|
|
|
|
406
|
|
|
public function GetAddressesFromRoute($route_id) |
407
|
|
|
{ |
408
|
|
|
$route1 = Route::getRoutes($route_id,null); |
409
|
|
|
|
410
|
|
|
if (isset($route1)) { |
411
|
|
|
return $route1->addresses; |
412
|
|
|
} else { |
413
|
|
|
return null; |
414
|
|
|
} |
415
|
|
|
} |
416
|
|
|
|
417
|
|
|
public function GetRandomAddressFromRoute($route_id) |
418
|
|
|
{ |
419
|
|
|
$route1 = Route::getRoutes($route_id, null); |
420
|
|
|
|
421
|
|
|
if (isset($route1)) { |
422
|
|
|
$addresses = $route1->addresses; |
423
|
|
|
|
424
|
|
|
$rnd = rand(0, sizeof($addresses) - 1); |
425
|
|
|
|
426
|
|
|
return $addresses[$rnd]; |
427
|
|
|
} else { |
428
|
|
|
return null; |
429
|
|
|
} |
430
|
|
|
} |
431
|
|
|
|
432
|
|
|
public function getRouteId() |
433
|
|
|
{ |
434
|
|
|
return $this->route_id; |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
public function getOptimizationId() |
438
|
|
|
{ |
439
|
|
|
return $this->optimization_problem_id; |
440
|
|
|
} |
441
|
|
|
|
442
|
|
View Code Duplication |
public function GetLastLocation(array $params) |
|
|
|
|
443
|
|
|
{ |
444
|
|
|
$route = Route4Me::makeRequst(array( |
445
|
|
|
'url' => Endpoint::ROUTE_V4, |
446
|
|
|
'method' => 'GET', |
447
|
|
|
'query' => array( |
448
|
|
|
'api_key' => Route4Me::getApiKey(), |
449
|
|
|
'route_id' => isset($params['route_id']) ? $params['route_id'] : null, |
450
|
|
|
'device_tracking_history' => isset($params['device_tracking_history']) ? $params['device_tracking_history'] : null |
451
|
|
|
) |
452
|
|
|
)); |
453
|
|
|
|
454
|
|
|
return Route::fromArray($route); |
455
|
|
|
} |
456
|
|
|
|
457
|
|
View Code Duplication |
public function GetTrackingHistoryFromTimeRange(array $params) |
|
|
|
|
458
|
|
|
{ |
459
|
|
|
$route = Route4Me::makeRequst(array( |
460
|
|
|
'url' => Endpoint::GET_DEVICE_LOCATION, |
461
|
|
|
'method' => 'GET', |
462
|
|
|
'query' => array( |
463
|
|
|
'api_key' => Route4Me::getApiKey(), |
464
|
|
|
'route_id' => isset($params['route_id']) ? $params['route_id'] : null, |
465
|
|
|
'format' => isset($params['format']) ? $params['format'] : null, |
466
|
|
|
'time_period' => isset($params['time_period']) ? $params['time_period'] : null, |
467
|
|
|
'start_date' => isset($params['start_date']) ? $params['start_date'] : null, |
468
|
|
|
'end_date' => isset($params['end_date']) ? $params['end_date'] : null |
469
|
|
|
) |
470
|
|
|
)); |
471
|
|
|
|
472
|
|
|
return $route; |
473
|
|
|
} |
474
|
|
|
|
475
|
|
View Code Duplication |
public function GetAssetTracking(array $params) |
|
|
|
|
476
|
|
|
{ |
477
|
|
|
$route = Route4Me::makeRequst(array( |
478
|
|
|
'url' => Endpoint::STATUS_V4, |
479
|
|
|
'method' => 'GET', |
480
|
|
|
'query' => array( |
481
|
|
|
'api_key' => Route4Me::getApiKey(), |
482
|
|
|
'tracking' => isset($params['tracking']) ? $params['tracking'] : null |
483
|
|
|
) |
484
|
|
|
)); |
485
|
|
|
|
486
|
|
|
return $route; |
487
|
|
|
} |
488
|
|
|
} |
489
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.