GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Failed
Push — master ( ce7ad9...c183ba )
by Igor
08:49 queued 18s
created
src/Route4Me/Enum/Endpoint.php 1 patch
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -4,74 +4,74 @@
 block discarded – undo
4 4
 
5 5
 class Endpoint
6 6
 {
7
-    const BASE_URL = 'https://api.route4me.com';
8
-    const WH_BASE_URL = 'https://wh.route4me.com/modules';
9
-
10
-    const AVOIDANCE_ZONE = '/api.v4/avoidance.php';
11
-    const TERRITORY_V4 = '/api.v4/territory.php';
12
-
13
-    const GET_ACTIVITIES = '/api/get_activities.php';
14
-    const ACTIVITY_FEED = '/api.v4/activity_feed.php';
15
-
16
-    const ADDRESS_V4 = '/api.v4/address.php';
17
-    const MOVE_ROUTE_DESTINATION = '/actions/route/move_route_destination.php';
18
-    const MARK_ADDRESS_DEPARTED = '/api/route/mark_address_departed.php';
19
-    const UPDATE_ADDRESS_VISITED = '/actions/address/update_address_visited.php';
20
-
21
-    const ADDRESS_BOOK_V4 = '/api.v4/address_book.php';
22
-    const ADDRESS_BOOK_GROUP = '/api.v4/address_book_group.php';
23
-    const ADDRESS_BOOK_SEARCH = '/api/address_book/get_search_group_addresses.php';
24
-    const MODIFY_CONTACT = '/api/address_book/modify_contact.php';
25
-
26
-    const GEOCODER = '/api/geocoder.php';
27
-    const JSON_GEOCODE = '/actions/upload/json-geocode.php';
28
-    const STREET_DATA = 'https://rapid.route4me.com/street_data/';
29
-    const STREET_DATA_ZIPCODE = 'https://rapid.route4me.com/street_data/zipcode/';
30
-    const STREET_DATA_SERVICE = 'https://rapid.route4me.com/street_data/service/';
31
-
32
-    const USER_V4 = '/api.v4/user.php';
33
-    const VERIFY_DEVICE_LICENSE = '/api/device/verify_device_license.php';
34
-    const USER_LICENSE = '/api/member/user_license.php';
35
-    const WEBINAR_REGISTER = '/actions/webinar_register.php';
36
-    const EXPIRE_SESSION = '/datafeed/session/expire_session.php';
37
-    const VALIDATE_SESSION = '/datafeed/session/validate_session.php';
38
-    const AUTHENTICATE = '/actions/authenticate.php';
39
-    const REGISTER_ACTION = '/actions/register_action.php';
40
-    const VIEW_USER_LOCATIONS = '/api/track/view_user_locations.php';
41
-    const CONFIGURATION_SETTINGS = '/api.v4/configuration-settings.php';
42
-
43
-    const OPTIMIZATION_PROBLEM = '/api.v4/optimization_problem.php';
44
-    const HYBRID_DATE_OPTIMIZATION = '/api.v4/hybrid_date_optimization.php';
45
-    const CHANGE_HYBRID_OPTIMIZATION_DEPOT = '/api/change_hybrid_optimization_depot.php';
46
-
47
-    const ORDER_V4 = '/api.v4/order.php';
48
-    const ORDER_CUSTOM_FIELDS_V4 = '/api.v4/order_custom_user_fields.php';
49
-
50
-    const ROUTE_V4 = '/api.v4/route.php';
51
-    const ROUTE_DUPLICATE = '/actions/duplicate_route.php';
52
-    const ROUTES_DELETE = '/actions/delete_routes.php';
53
-    const REOPTIMIZE_V3_2 = '/api.v3/route/reoptimize_2.php';
54
-    const ROUTES_MERGE = '/actions/merge_routes.php';
55
-    const ROUTE_SHARE = '/actions/route/share_route.php';
56
-    const ROUTE_NOTES_ADD = '/actions/addRouteNotes.php';
57
-    const STATUS_V4 = '/api.v4/status.php';
58
-
59
-    const GET_DEVICE_LOCATION = '/api/track/get_device_location.php';
60
-    const TRACK_SET = '/track/set.php';
61
-    const USER_LOCATION = '/api/track/view_user_locations.php';
62
-
63
-    const NOTE_CUSTOM_TYPES_V4 = '/api.v4/note_custom_types.php';
64
-
65
-    const ViewVehicles = '/api/vehicles/view_vehicles.php';
66
-    const VEHICLE_V4 = '/api/vehicles';
67
-    const VEHICLE_V4_API = '/api.v4/vehicle.php';
7
+	const BASE_URL = 'https://api.route4me.com';
8
+	const WH_BASE_URL = 'https://wh.route4me.com/modules';
9
+
10
+	const AVOIDANCE_ZONE = '/api.v4/avoidance.php';
11
+	const TERRITORY_V4 = '/api.v4/territory.php';
12
+
13
+	const GET_ACTIVITIES = '/api/get_activities.php';
14
+	const ACTIVITY_FEED = '/api.v4/activity_feed.php';
15
+
16
+	const ADDRESS_V4 = '/api.v4/address.php';
17
+	const MOVE_ROUTE_DESTINATION = '/actions/route/move_route_destination.php';
18
+	const MARK_ADDRESS_DEPARTED = '/api/route/mark_address_departed.php';
19
+	const UPDATE_ADDRESS_VISITED = '/actions/address/update_address_visited.php';
20
+
21
+	const ADDRESS_BOOK_V4 = '/api.v4/address_book.php';
22
+	const ADDRESS_BOOK_GROUP = '/api.v4/address_book_group.php';
23
+	const ADDRESS_BOOK_SEARCH = '/api/address_book/get_search_group_addresses.php';
24
+	const MODIFY_CONTACT = '/api/address_book/modify_contact.php';
25
+
26
+	const GEOCODER = '/api/geocoder.php';
27
+	const JSON_GEOCODE = '/actions/upload/json-geocode.php';
28
+	const STREET_DATA = 'https://rapid.route4me.com/street_data/';
29
+	const STREET_DATA_ZIPCODE = 'https://rapid.route4me.com/street_data/zipcode/';
30
+	const STREET_DATA_SERVICE = 'https://rapid.route4me.com/street_data/service/';
31
+
32
+	const USER_V4 = '/api.v4/user.php';
33
+	const VERIFY_DEVICE_LICENSE = '/api/device/verify_device_license.php';
34
+	const USER_LICENSE = '/api/member/user_license.php';
35
+	const WEBINAR_REGISTER = '/actions/webinar_register.php';
36
+	const EXPIRE_SESSION = '/datafeed/session/expire_session.php';
37
+	const VALIDATE_SESSION = '/datafeed/session/validate_session.php';
38
+	const AUTHENTICATE = '/actions/authenticate.php';
39
+	const REGISTER_ACTION = '/actions/register_action.php';
40
+	const VIEW_USER_LOCATIONS = '/api/track/view_user_locations.php';
41
+	const CONFIGURATION_SETTINGS = '/api.v4/configuration-settings.php';
42
+
43
+	const OPTIMIZATION_PROBLEM = '/api.v4/optimization_problem.php';
44
+	const HYBRID_DATE_OPTIMIZATION = '/api.v4/hybrid_date_optimization.php';
45
+	const CHANGE_HYBRID_OPTIMIZATION_DEPOT = '/api/change_hybrid_optimization_depot.php';
46
+
47
+	const ORDER_V4 = '/api.v4/order.php';
48
+	const ORDER_CUSTOM_FIELDS_V4 = '/api.v4/order_custom_user_fields.php';
49
+
50
+	const ROUTE_V4 = '/api.v4/route.php';
51
+	const ROUTE_DUPLICATE = '/actions/duplicate_route.php';
52
+	const ROUTES_DELETE = '/actions/delete_routes.php';
53
+	const REOPTIMIZE_V3_2 = '/api.v3/route/reoptimize_2.php';
54
+	const ROUTES_MERGE = '/actions/merge_routes.php';
55
+	const ROUTE_SHARE = '/actions/route/share_route.php';
56
+	const ROUTE_NOTES_ADD = '/actions/addRouteNotes.php';
57
+	const STATUS_V4 = '/api.v4/status.php';
58
+
59
+	const GET_DEVICE_LOCATION = '/api/track/get_device_location.php';
60
+	const TRACK_SET = '/track/set.php';
61
+	const USER_LOCATION = '/api/track/view_user_locations.php';
62
+
63
+	const NOTE_CUSTOM_TYPES_V4 = '/api.v4/note_custom_types.php';
64
+
65
+	const ViewVehicles = '/api/vehicles/view_vehicles.php';
66
+	const VEHICLE_V4 = '/api/vehicles';
67
+	const VEHICLE_V4_API = '/api.v4/vehicle.php';
68 68
     
69
-    const TELEMATICS_VENDORS = "http://telematics.route4me.com/api/vendors.php";
70
-    const TELEMATICS_REGISTER_MEMBER =  "/api.v4/telematics/register.php";
71
-    const TELEMATICS_CONNECTION =  "/api.v4/telematics/connections.php";
72
-    const TELEMATICS_VENDORS_INFO =  "/api.v4/telematics/vendors.php";
69
+	const TELEMATICS_VENDORS = "http://telematics.route4me.com/api/vendors.php";
70
+	const TELEMATICS_REGISTER_MEMBER =  "/api.v4/telematics/register.php";
71
+	const TELEMATICS_CONNECTION =  "/api.v4/telematics/connections.php";
72
+	const TELEMATICS_VENDORS_INFO =  "/api.v4/telematics/vendors.php";
73 73
 
74
-    const MEMBER_CAPABILITIES = "/api/member/capabilities.php";
74
+	const MEMBER_CAPABILITIES = "/api/member/capabilities.php";
75 75
 
76
-    const SCHEDULE_CALENDAR = "/api/schedule_calendar_data.php";
76
+	const SCHEDULE_CALENDAR = "/api/schedule_calendar_data.php";
77 77
 }
Please login to merge, or discard this patch.
src/Route4Me/Enum/Avoidance.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 
5 5
 class Avoidance
6 6
 {
7
-    const HIGHWAYS = 'Highways';
8
-    const TOLLS = 'Tolls';
9
-    const MINIMIZE_HIGHWAYS = 'minimizeHighways';
10
-    const MINIMIZE_TOLLS = 'minimizeTolls';
7
+	const HIGHWAYS = 'Highways';
8
+	const TOLLS = 'Tolls';
9
+	const MINIMIZE_HIGHWAYS = 'minimizeHighways';
10
+	const MINIMIZE_TOLLS = 'minimizeTolls';
11 11
 }
Please login to merge, or discard this patch.
src/Route4Me/V5/Members/DriverRatingApi/DriverReviewsResponse.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -10,18 +10,18 @@
 block discarded – undo
10 10
  */
11 11
 class DriverReviewsResponse extends \Route4Me\Common
12 12
 {
13
-    /** An array of the driver reviews.
14
-     * @var DriverReview[] $data
15
-     */
16
-    public $data = [];
13
+	/** An array of the driver reviews.
14
+	 * @var DriverReview[] $data
15
+	 */
16
+	public $data = [];
17 17
 
18
-    /** The response pagination info.
19
-     * @var SimplePaginationData $simple_pagination
20
-     */
21
-    public $simple_pagination = [];
18
+	/** The response pagination info.
19
+	 * @var SimplePaginationData $simple_pagination
20
+	 */
21
+	public $simple_pagination = [];
22 22
 
23
-    /** Statistics by driver rating.
24
-     * @var TypeQuantity[] $total
25
-     */
26
-    public $total = [];
23
+	/** Statistics by driver rating.
24
+	 * @var TypeQuantity[] $total
25
+	 */
26
+	public $total = [];
27 27
 }
28 28
\ No newline at end of file
Please login to merge, or discard this patch.
src/Route4Me/V5/Members/DriverRatingApi/TypeQuantity.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
  */
10 10
 class TypeQuantity extends \Route4Me\Common
11 11
 {
12
-    public $type;
12
+	public $type;
13 13
 
14
-    public $quantity;
14
+	public $quantity;
15 15
 }
16 16
\ No newline at end of file
Please login to merge, or discard this patch.
src/Route4Me/V5/Routes/AddonRoutesApi/Route.php 1 patch
Indentation   +631 added lines, -631 removed lines patch added patch discarded remove patch
@@ -14,635 +14,635 @@
 block discarded – undo
14 14
 
15 15
 class Route extends DataObjectBase
16 16
 {
17
-    public $actual_footsteps;
18
-    public $actual_travel_distance;
19
-    public $actual_travel_time;
20
-    public $addresses_visited_count;
21
-    public $approved_for_execution;
22
-    public $approved_revisions_counter;
23
-    public $bundle_items;
24
-    public $channel_name;
25
-    public $day_id;
26
-    public $depot_address_id;
27
-    public $destination_count;
28
-    public $directions;
29
-    public $driver_alias;
30
-    public $driving_time;
31
-    public $gas_price;
32
-    public $geofence_polygon_size;
33
-    public $geofence_polygon_type;
34
-    public $idling_time;
35
-    public $is_master;
36
-    public $is_unrouted;
37
-    public $master_route_id;
38
-    public $member_config_storage;
39
-    public $member_email;
40
-    public $member_first_name;
41
-    public $member_id;
42
-    public $member_last_name;
43
-    public $member_picture;
44
-    public $member_tracking_subheadline;
45
-    public $mpg;
46
-    public $notes;
47
-    public $notes_count;
48
-    public $organization_id;
49
-    public $path;
50
-    public $paying_miles;
51
-    public $planned_total_route_duration;
52
-    public $root_member_id;
53
-    public $route_duration_sec;
54
-    public $route_end_time;
55
-    public $route_id;
56
-    public $route_progress;
57
-    public $route_start_time;
58
-    public $route_status;
59
-    public $total_wait_time;
60
-    public $trip_distance;
61
-    public $udu_actual_travel_distance;
62
-    public $udu_distance_unit;
63
-    public $udu_trip_distance;
64
-    public $user_route_rating;
65
-    public $vehicle;
66
-    public $vehicle_alias;
67
-    public $working_time;
68
-
69
-    public function __construct()
70
-    {
71
-        //\Route4Me\Route4Me::setBaseUrl(EndpointV4::BASE_URL);
72
-        \Route4Me\Route4Me::setBaseUrl("");
73
-    }
74
-
75
-    public static function fromArray(array $params)
76
-    {
77
-        $route = new self();
78
-
79
-        $route->route_id = Common::getValue($params,  'route_id');
80
-        $route->organization_id = Common::getValue($params,  'organization_id');
81
-        $route->route_progress = Common::getValue($params,  'route_progress');
82
-        $route->depot_address_id = Common::getValue($params,  'depot_address_id');
83
-        $route->root_member_id = Common::getValue($params,  'root_member_id');
84
-        $route->day_id = Common::getValue($params,  'day_id');
85
-        $route->addresses_visited_count = Common::getValue($params,  'addresses_visited_count');
86
-        $route->route_start_time = Common::getValue($params,  'route_start_time');
87
-        $route->route_end_time = Common::getValue($params,  'route_end_time');
88
-        $route->user_route_rating = Common::getValue($params,  'user_route_rating');
89
-        $route->member_id = Common::getValue($params,  'member_id');
90
-        $route->member_email = Common::getValue($params,  'member_email');
91
-        $route->member_first_name = Common::getValue($params,  'member_first_name');
92
-        $route->member_last_name = Common::getValue($params,  'member_last_name');
93
-        $route->channel_name = Common::getValue($params,  'channel_name');
94
-        $route->member_picture = Common::getValue($params,  'member_picture');
95
-        $route->member_tracking_subheadline = Common::getValue($params,  'member_tracking_subheadline');
96
-        $route->approved_for_execution = Common::getValue($params,  'approved_for_execution');
97
-        $route->approved_revisions_counter = Common::getValue($params,  'approved_revisions_counter');
98
-        $route->vehicle_alias = Common::getValue($params,  'vehicle_alias');
99
-        $route->driver_alias = Common::getValue($params,  'driver_alias');
100
-        $route->mpg = Common::getValue($params,  'mpg');
101
-        $route->trip_distance = Common::getValue($params,  'trip_distance');
102
-        $route->udu_distance_unit = Common::getValue($params,  'udu_distance_unit');
103
-        $route->udu_trip_distance = Common::getValue($params,  'udu_trip_distance');
104
-        $route->is_unrouted = Common::getValue($params,  'is_unrouted');
105
-        $route->gas_price = Common::getValue($params,  'gas_price');
106
-        $route->route_duration_sec = Common::getValue($params,  'route_duration_sec');
107
-        $route->planned_total_route_duration = Common::getValue($params,  'planned_total_route_duration');
108
-        $route->total_wait_time = Common::getValue($params,  'total_wait_time');
109
-        $route->udu_actual_travel_distance = Common::getValue($params,  'udu_actual_travel_distance');
110
-        $route->actual_travel_distance = Common::getValue($params,  'actual_travel_distance');
111
-        $route->actual_travel_time = Common::getValue($params,  'actual_travel_time');
112
-        $route->actual_footsteps = Common::getValue($params,  'actual_footsteps');
113
-        $route->working_time = Common::getValue($params,  'working_time');
114
-        $route->driving_time = Common::getValue($params,  'driving_time');
115
-        $route->idling_time = Common::getValue($params,  'idling_time');
116
-        $route->paying_miles = Common::getValue($params,  'paying_miles');
117
-        $route->geofence_polygon_type = Common::getValue($params,  'geofence_polygon_type');
118
-        $route->geofence_polygon_size = Common::getValue($params,  'geofence_polygon_size');
119
-        $route->destination_count = Common::getValue($params,  'destination_count');
120
-        $route->notes_count = Common::getValue($params,  'notes_count');
121
-        $route->notes = Common::getValue($params,  'notes');
122
-        $route->directions = Common::getValue($params,  'directions');
123
-        $route->path = Common::getValue($params,  'path');
124
-        $route->vehicle = Common::getValue($params,  'vehicle');
125
-        $route->member_config_storage = Common::getValue($params,  'member_config_storage');
126
-        $route->is_master = Common::getValue($params,  'is_master');
127
-        $route->bundle_items = Common::getValue($params,  'bundle_items');
128
-        $route->master_route_id = Common::getValue($params,  'master_route_id');
129
-        $route->route_status = Common::getValue($params,  'route_status');
130
-
131
-        if (isset($params['vehicle'])) {
132
-            $route->vehicle = new Vehicle();
133
-            $route->vehicle = Vehicle::fromArray($params['vehicle']);
134
-            //Route4Me::setBaseUrl(Endpoint::BASE_URL);
135
-        };
136
-
137
-        $route->member_config_storage = Common::getvalue($params, 'member_config_storage');
138
-
139
-        // Make RouteParameters
140
-        if (isset($params['parameters'])) {
141
-            $route->parameters = new RouteParameters();
142
-            $route->parameters = RouteParameters::fromArray($params['parameters']);
143
-            Route4Me::setBaseUrl(EndpointV4::BASE_URL);
144
-        }
145
-
146
-        if (isset($params['addresses'])) {
147
-            $addresses = [];
148
-
149
-            foreach ($params['addresses'] as $address) {
150
-                $addresses[] = Address::fromArray($address);
151
-            }
152
-
153
-            $route->addresses = $addresses;
154
-        }
155
-
156
-        $route->links = Common::getValue($params, 'links', []);
157
-        $route->notes = Common::getValue($params, 'notes', []);
158
-        $route->directions = Common::getValue($params, 'directions', []);
159
-        $route->path = Common::getValue($params, 'path', []);
160
-        $route->tracking_history = Common::getValue($params, 'tracking_history', []);
161
-
162
-        if (isset($params['original_route'])) {
163
-            $route->original_route = Route::fromArray($params['original_route']);
164
-        };
165
-
166
-        return $route;
167
-    }
168
-
169
-    public static function getRoutes($params = null)
170
-    {
171
-        $allQueryFields = RouteParametersQuery::getAllProperties();
172
-
173
-        $result = Route4Me::makeRequst([
174
-            'url'       => Endpoint::Routes,
175
-            'method'    => 'GET',
176
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
177
-        ]);
178
-
179
-        if (isset($params['route_id'])) {
180
-            if (strlen($params['route_id'])==32) {
181
-                return self::fromArray($result);
182
-            } else {
183
-                return $result;
184
-            }
185
-        } else {
186
-            $routes = [];
187
-            foreach ($result as $route) {
188
-                $routes[] = self::fromArray($route);
189
-            }
190
-
191
-            return $routes;
192
-        }
193
-    }
194
-
195
-    public function getAllRoutesWithPagination($params)
196
-    {
197
-        $allQueryFields = RouteParametersQuery::getAllProperties();
198
-
199
-        $result = Route4Me::makeRequst([
200
-            'url'       => Endpoint::RoutesPaginate,
201
-            'method'    => 'GET',
202
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
203
-        ]);
204
-
205
-        return $result;
206
-    }
207
-
208
-    public function  getPaginatedRouteListWithoutElasticSearch($params)
209
-    {
210
-        $allQueryFields = RouteParametersQuery::getAllProperties();
211
-
212
-        $result = Route4Me::makeRequst([
213
-            'url'       => Endpoint::RoutesFallbackPaginate,
214
-            'method'    => 'GET',
215
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
216
-        ]);
217
-
218
-        return $result;
219
-    }
220
-
221
-    public function getRouteDataTableWithoutElasticSearch($params)
222
-    {
223
-        $allBodyFields = ['query', 'filters', 'directions', 'notes', 'page',
224
-            'per_page', 'order_by', 'timezone'];
225
-
226
-        $result = Route4Me::makeRequst([
227
-            'url'           => Endpoint::RoutesFallbackDatatable,
228
-            'method'        => 'POST',
229
-            'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
230
-        ]);
231
-
232
-        return $result;
233
-    }
234
-
235
-    public function getRouteDataTableWithElasticSearch($params)
236
-    {
237
-        $allBodyFields = ['query', 'filters', 'directions', 'notes', 'page',
238
-            'per_page', 'order_by', 'timezone'];
239
-
240
-        $result = Route4Me::makeRequst([
241
-            'url'           => Endpoint::RoutesDatatable,
242
-            'method'        => 'POST',
243
-            'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
244
-        ]);
245
-
246
-        return $result;
247
-    }
248
-
249
-    public function getRouteListWithoutElasticSearch($params)
250
-    {
251
-        $allQueryFields = RouteParametersQuery::getAllProperties();
252
-
253
-        $result = Route4Me::makeRequst([
254
-            'url'       => Endpoint::RoutesFallback,
255
-            'method'    => 'GET',
256
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
257
-        ]);
258
-
259
-        if (isset($params['route_id'])) {
260
-            if (strlen($params['route_id'])==32) {
261
-                return self::fromArray($result);
262
-            } else {
263
-                return $result;
264
-            }
265
-        } else {
266
-            $routes = [];
267
-            foreach ($result as $route) {
268
-                $routes[] = self::fromArray($route);
269
-            }
270
-
271
-            return $routes;
272
-        }
273
-    }
274
-
275
-    public function duplicateRoute($routeIDs)
276
-    {
277
-        $result = Route4Me::makeRequst([
278
-            'url'    => Endpoint::RoutesDuplicate,
279
-            'method' => 'POST',
280
-            'body'   => [
281
-                'duplicate_routes_id' => $routeIDs
282
-            ],
283
-            'HTTPHEADER'    => 'Content-Type: application/json; Accept: application/json',
284
-        ]);
285
-
286
-        return $result;
287
-    }
288
-
289
-    public function deleteRoutes($routeIDs)
290
-    {
291
-        $routeId = "";
292
-        foreach ($routeIDs as $rid) {
293
-            $routeId.=$rid.',';
294
-        }
295
-
296
-        $routeId = rtrim($routeId, ',');
297
-
298
-        $result = Route4Me::makeRequst([
299
-            'url'    => Endpoint::Routes,
300
-            'method' => 'DELETE',
301
-            'query'  => [
302
-                'route_id' => $routeId,
303
-            ],
304
-        ]);
305
-
306
-        return $result;
307
-    }
308
-
309
-    public function getRouteDataTableConfig()
310
-    {
311
-        $result = Route4Me::makeRequst([
312
-            'url'       => Endpoint::RoutesDatatableConfig,
313
-            'method'    => 'GET',
314
-            'query'     => null,
315
-        ]);
316
-
317
-        return $result;
318
-    }
319
-
320
-    public function getRouteDataTableFallbackConfig()
321
-    {
322
-        $result = Route4Me::makeRequst([
323
-            'url'       => Endpoint::RoutesDatatableConfigFallback,
324
-            'method'    => 'GET',
325
-            'query'     => null,
326
-        ]);
327
-
328
-        return $result;
329
-    }
330
-
331
-    public function updateRouteParameters($queryParams, $routeParams)
332
-    {
333
-        $allQueryFields = RouteParametersQuery::getAllProperties();
334
-        $allBodyFields = RouteParameters:: getAllProperties();
335
-
336
-        $bodyParams = ['parameters' => Route4Me::generateRequestParameters($allBodyFields, $routeParams)];
337
-
338
-        $result = Route4Me::makeRequst([
339
-            'url'       => Endpoint::Routes,
340
-            'method'    => 'PUT',
341
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $queryParams),
342
-            'body'      => $bodyParams,
343
-            'HTTPHEADER'    => 'Content-Type: application/json; Accept: application/json',
344
-        ]);
345
-
346
-        return $result;
347
-    }
348
-
349
-
350
-
351
-
352
-    public function getRoutePoints($params)
353
-    {
354
-        $allQueryFields = ['route_id', 'route_path_output', 'compress_path_points', 'directions'];
355
-
356
-        $result = Route4Me::makeRequst([
357
-            'url'    => Endpoint::ROUTE_V4,
358
-            'method' => 'GET',
359
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
360
-        ]);
361
-
362
-        return $result;
363
-    }
364
-
365
-
366
-
367
-    public function resequenceRoute($params)
368
-    {
369
-        $allQueryFields = ['route_id', 'route_destination_id'];
370
-        $allBodyFields = ['addresses'];
371
-
372
-        $result = Route4Me::makeRequst([
373
-            'url'       => Endpoint::ROUTE_V4,
374
-            'method'    => 'PUT',
375
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
376
-            'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
377
-        ]);
378
-
379
-        return $result;
380
-    }
381
-
382
-    public function resequenceAllAddresses($params)
383
-    {
384
-        $allQueryFields = ['route_id', 'disable_optimization', 'optimize'];
385
-
386
-        $result = Route4Me::makeRequst([
387
-            'url'       => Endpoint::REOPTIMIZE_V3_2,
388
-            'method'    => 'GET',
389
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
390
-        ]);
391
-
392
-        return $result;
393
-    }
394
-
395
-    public function mergeRoutes($params)
396
-    {
397
-        $allBodyFields = ['route_ids', 'depot_address', 'remove_origin', 'depot_lat',  'depot_lng'];
398
-
399
-        $result = Route4Me::makeRequst([
400
-            'url'           => Endpoint::ROUTES_MERGE,
401
-            'method'        => 'POST',
402
-            'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
403
-            'HTTPHEADER'    => 'Content-Type: multipart/form-data',
404
-        ]);
405
-
406
-        return $result;
407
-    }
408
-
409
-    public function shareRoute($params)
410
-    {
411
-        $allQueryFields = ['route_id', 'response_format'];
412
-        $allBodyFields = ['recipient_email'];
413
-
414
-        $result = Route4Me::makeRequst([
415
-            'url'           => Endpoint::ROUTE_SHARE,
416
-            'method'        => 'POST',
417
-            'query'         => Route4Me::generateRequestParameters($allQueryFields, $params),
418
-            'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
419
-            'HTTPHEADER'    => 'Content-Type: multipart/form-data',
420
-        ]);
421
-
422
-        return $result;
423
-    }
424
-
425
-    // Returns random route_id from existing routes between $offset and $offset+$limit
426
-    public function getRandomRouteId($offset, $limit)
427
-    {
428
-        $params = [
429
-            'offset'    => !is_null($offset) ? $offset : 0,
430
-            'limit'     => !is_null($limit) ? $limit : 30,
431
-        ];
432
-
433
-        $route = new self();
434
-        $routes = $route->getRoutes($params);
435
-
436
-        if (is_null($routes) || sizeof($routes) < 1) {
437
-            echo '<br> There are no routes in the account. Please, create the routes first. <br>';
438
-
439
-            return null;
440
-        }
441
-
442
-        $randomIndex = rand(0, sizeof($routes) - 1);
443
-
444
-        return $routes[$randomIndex]->route_id;
445
-    }
446
-
447
-    public function updateRoute($params)
448
-    {
449
-        $allQueryFields = ['route_id', 'reoptimize','route_destination_id'];
450
-        $allBodyFields = ['addresses', 'parameters', 'unlink_from_master_optimization'];
451
-
452
-        $result = Route4Me::makeRequst([
453
-            'url'       => Endpoint::ROUTE_V4,
454
-            'method'    => 'PUT',
455
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
456
-            'body'      => (isset($params['addresses']) || isset($params['parameters']) || isset($params['unlink_from_master_optimization']))
457
-                            ? Route4Me::generateRequestParameters($allBodyFields, $params)
458
-                            : null,
459
-        ]);
460
-
461
-        return $result;
462
-    }
463
-
464
-    public function update()
465
-    {
466
-        $route = Route4Me::makeRequst([
467
-            'url'    => Endpoint::ROUTE_V4,
468
-            'method' => 'PUT',
469
-            'query'  => [
470
-                'route_id' => isset($this->route_id) ? $this->route_id : null,
471
-            ],
472
-            'body'   => [
473
-                'parameters' => $this->parameters,
474
-                ],
475
-            'HTTPHEADER' => isset($this->httpheaders) ? $this->httpheaders : null,
476
-        ]);
477
-
478
-        return self::fromArray($route);
479
-    }
480
-
481
-    public function updateAddress($address = null)
482
-    {
483
-        $body = sizeof($this->addresses) < 1 ? get_object_vars($this->parameters)
484
-            : (isset($this->addresses[0]) ? $this->addresses[0] : get_object_vars($this->parameters));
485
-
486
-        $result = Route4Me::makeRequst([
487
-            'url'    => Endpoint::ADDRESS_V4,
488
-            'method' => 'PUT',
489
-            'query'  => [
490
-                'route_id' => isset($this->route_id) ? $this->route_id : null,
491
-                'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
492
-            ],
493
-            'body'   => $body,
494
-            'HTTPHEADER' => isset($this->httpheaders) ? $this->httpheaders : null,
495
-        ]);
496
-
497
-        return $result;
498
-    }
499
-
500
-    public function updateRouteAddress()
501
-    {
502
-        $result = Route4Me::makeRequst([
503
-            'url'    => Endpoint::ADDRESS_V4,
504
-            'method' => 'PUT',
505
-            'query'  => [
506
-                'route_id' => isset($this->route_id) ? $this->route_id : null,
507
-                'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
508
-            ],
509
-            'body'   => [
510
-                'parameters' => isset($this->parameters) ? get_object_vars($this->parameters) : null,
511
-                'addresses' => isset($this->addresses) ? $this->addresses : null,
512
-            ],
513
-            'HTTPHEADER' => isset($this->httpheaders) ? $this->httpheaders : null,
514
-        ]);
515
-
516
-        return $result;
517
-    }
518
-
519
-    public function addAddresses($params)
520
-    {
521
-        $allQueryFields = ['route_id'];
522
-        $allBodyFields = ['addresses'];
523
-
524
-        $route = Route4Me::makeRequst([
525
-            'url'           => Endpoint::ROUTE_V4,
526
-            'method'        => 'PUT',
527
-            'query'         => Route4Me::generateRequestParameters($allQueryFields, $params),
528
-            'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
529
-            'HTTPHEADER'    => isset($this->httpheaders) ? $this->httpheaders : null,
530
-        ]);
531
-
532
-        return self::fromArray($route);
533
-    }
534
-
535
-    public function insertAddressOptimalPosition(array $params)
536
-    {
537
-        $allQueryFields = ['route_id'];
538
-        $allBodyFields = ['addresses', 'optimal_position'];
539
-
540
-        $route = Route4Me::makeRequst([
541
-            'url'    => Endpoint::ROUTE_V4,
542
-            'method' => 'PUT',
543
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
544
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
545
-        ]);
546
-
547
-        return self::fromArray($route);
548
-    }
549
-
550
-    public function addNoteFile($params)
551
-    {
552
-        $fname = isset($params['strFilename']) ? $params['strFilename'] : null;
553
-        $rpath = realpath($fname);
554
-
555
-        $allQueryFields = ['route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type'];
556
-        $allBodyFields = ['strUpdateType', 'strFilename', 'strNoteContents'];
557
-
558
-        $result = Route4Me::makeRequst([
559
-            'url'    => Endpoint::ROUTE_NOTES_ADD,
560
-            'method' => 'POST',
561
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
562
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
563
-            'FILE'   => $rpath,
564
-            'HTTPHEADER' => [
565
-                'Content-Type: application/x-www-form-urlencoded',
566
-            ],
567
-        ]);
568
-
569
-        return $result;
570
-    }
571
-
572
-
573
-
574
-    public function GetAddressesFromRoute($route_id)
575
-    {
576
-        $route1 = self::getRoutes(['route_id' => $route_id]);
577
-
578
-        if (isset($route1)) {
579
-            return $route1->addresses;
580
-        } else {
581
-            return null;
582
-        }
583
-    }
584
-
585
-    public function GetRandomAddressFromRoute($route_id)
586
-    {
587
-        $route1 = self::getRoutes(['route_id' => $route_id]);
588
-
589
-        if (isset($route1)) {
590
-            $addresses = $route1->addresses;
591
-
592
-            $rnd = rand(0, sizeof($addresses) - 1);
593
-
594
-            return $addresses[$rnd];
595
-        } else {
596
-            return null;
597
-        }
598
-    }
599
-
600
-    public function getRouteId()
601
-    {
602
-        return $this->route_id;
603
-    }
604
-
605
-    public function getOptimizationId()
606
-    {
607
-        return $this->optimization_problem_id;
608
-    }
609
-
610
-    public function GetLastLocation(array $params)
611
-    {
612
-        $allQueryFields = ['route_id', 'device_tracking_history'];
613
-
614
-        $route = Route4Me::makeRequst([
615
-            'url'    => Endpoint::ROUTE_V4,
616
-            'method' => 'GET',
617
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
618
-        ]);
619
-
620
-        return self::fromArray($route);
621
-    }
622
-
623
-    public function GetTrackingHistoryFromTimeRange(array $params)
624
-    {
625
-        $allQueryFields = ['route_id', 'format', 'time_period', 'start_date', 'end_date'];
626
-
627
-        $route = Route4Me::makeRequst([
628
-            'url'    => Endpoint::GET_DEVICE_LOCATION,
629
-            'method' => 'GET',
630
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
631
-        ]);
632
-
633
-        return $route;
634
-    }
635
-
636
-    public function GetAssetTracking(array $params)
637
-    {
638
-        $allQueryFields = ['tracking'];
639
-
640
-        $assetResponse = Route4Me::makeRequst([
641
-            'url'    => Endpoint::STATUS_V4,
642
-            'method' => 'GET',
643
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
644
-        ]);
645
-
646
-        return $assetResponse;
647
-    }
17
+	public $actual_footsteps;
18
+	public $actual_travel_distance;
19
+	public $actual_travel_time;
20
+	public $addresses_visited_count;
21
+	public $approved_for_execution;
22
+	public $approved_revisions_counter;
23
+	public $bundle_items;
24
+	public $channel_name;
25
+	public $day_id;
26
+	public $depot_address_id;
27
+	public $destination_count;
28
+	public $directions;
29
+	public $driver_alias;
30
+	public $driving_time;
31
+	public $gas_price;
32
+	public $geofence_polygon_size;
33
+	public $geofence_polygon_type;
34
+	public $idling_time;
35
+	public $is_master;
36
+	public $is_unrouted;
37
+	public $master_route_id;
38
+	public $member_config_storage;
39
+	public $member_email;
40
+	public $member_first_name;
41
+	public $member_id;
42
+	public $member_last_name;
43
+	public $member_picture;
44
+	public $member_tracking_subheadline;
45
+	public $mpg;
46
+	public $notes;
47
+	public $notes_count;
48
+	public $organization_id;
49
+	public $path;
50
+	public $paying_miles;
51
+	public $planned_total_route_duration;
52
+	public $root_member_id;
53
+	public $route_duration_sec;
54
+	public $route_end_time;
55
+	public $route_id;
56
+	public $route_progress;
57
+	public $route_start_time;
58
+	public $route_status;
59
+	public $total_wait_time;
60
+	public $trip_distance;
61
+	public $udu_actual_travel_distance;
62
+	public $udu_distance_unit;
63
+	public $udu_trip_distance;
64
+	public $user_route_rating;
65
+	public $vehicle;
66
+	public $vehicle_alias;
67
+	public $working_time;
68
+
69
+	public function __construct()
70
+	{
71
+		//\Route4Me\Route4Me::setBaseUrl(EndpointV4::BASE_URL);
72
+		\Route4Me\Route4Me::setBaseUrl("");
73
+	}
74
+
75
+	public static function fromArray(array $params)
76
+	{
77
+		$route = new self();
78
+
79
+		$route->route_id = Common::getValue($params,  'route_id');
80
+		$route->organization_id = Common::getValue($params,  'organization_id');
81
+		$route->route_progress = Common::getValue($params,  'route_progress');
82
+		$route->depot_address_id = Common::getValue($params,  'depot_address_id');
83
+		$route->root_member_id = Common::getValue($params,  'root_member_id');
84
+		$route->day_id = Common::getValue($params,  'day_id');
85
+		$route->addresses_visited_count = Common::getValue($params,  'addresses_visited_count');
86
+		$route->route_start_time = Common::getValue($params,  'route_start_time');
87
+		$route->route_end_time = Common::getValue($params,  'route_end_time');
88
+		$route->user_route_rating = Common::getValue($params,  'user_route_rating');
89
+		$route->member_id = Common::getValue($params,  'member_id');
90
+		$route->member_email = Common::getValue($params,  'member_email');
91
+		$route->member_first_name = Common::getValue($params,  'member_first_name');
92
+		$route->member_last_name = Common::getValue($params,  'member_last_name');
93
+		$route->channel_name = Common::getValue($params,  'channel_name');
94
+		$route->member_picture = Common::getValue($params,  'member_picture');
95
+		$route->member_tracking_subheadline = Common::getValue($params,  'member_tracking_subheadline');
96
+		$route->approved_for_execution = Common::getValue($params,  'approved_for_execution');
97
+		$route->approved_revisions_counter = Common::getValue($params,  'approved_revisions_counter');
98
+		$route->vehicle_alias = Common::getValue($params,  'vehicle_alias');
99
+		$route->driver_alias = Common::getValue($params,  'driver_alias');
100
+		$route->mpg = Common::getValue($params,  'mpg');
101
+		$route->trip_distance = Common::getValue($params,  'trip_distance');
102
+		$route->udu_distance_unit = Common::getValue($params,  'udu_distance_unit');
103
+		$route->udu_trip_distance = Common::getValue($params,  'udu_trip_distance');
104
+		$route->is_unrouted = Common::getValue($params,  'is_unrouted');
105
+		$route->gas_price = Common::getValue($params,  'gas_price');
106
+		$route->route_duration_sec = Common::getValue($params,  'route_duration_sec');
107
+		$route->planned_total_route_duration = Common::getValue($params,  'planned_total_route_duration');
108
+		$route->total_wait_time = Common::getValue($params,  'total_wait_time');
109
+		$route->udu_actual_travel_distance = Common::getValue($params,  'udu_actual_travel_distance');
110
+		$route->actual_travel_distance = Common::getValue($params,  'actual_travel_distance');
111
+		$route->actual_travel_time = Common::getValue($params,  'actual_travel_time');
112
+		$route->actual_footsteps = Common::getValue($params,  'actual_footsteps');
113
+		$route->working_time = Common::getValue($params,  'working_time');
114
+		$route->driving_time = Common::getValue($params,  'driving_time');
115
+		$route->idling_time = Common::getValue($params,  'idling_time');
116
+		$route->paying_miles = Common::getValue($params,  'paying_miles');
117
+		$route->geofence_polygon_type = Common::getValue($params,  'geofence_polygon_type');
118
+		$route->geofence_polygon_size = Common::getValue($params,  'geofence_polygon_size');
119
+		$route->destination_count = Common::getValue($params,  'destination_count');
120
+		$route->notes_count = Common::getValue($params,  'notes_count');
121
+		$route->notes = Common::getValue($params,  'notes');
122
+		$route->directions = Common::getValue($params,  'directions');
123
+		$route->path = Common::getValue($params,  'path');
124
+		$route->vehicle = Common::getValue($params,  'vehicle');
125
+		$route->member_config_storage = Common::getValue($params,  'member_config_storage');
126
+		$route->is_master = Common::getValue($params,  'is_master');
127
+		$route->bundle_items = Common::getValue($params,  'bundle_items');
128
+		$route->master_route_id = Common::getValue($params,  'master_route_id');
129
+		$route->route_status = Common::getValue($params,  'route_status');
130
+
131
+		if (isset($params['vehicle'])) {
132
+			$route->vehicle = new Vehicle();
133
+			$route->vehicle = Vehicle::fromArray($params['vehicle']);
134
+			//Route4Me::setBaseUrl(Endpoint::BASE_URL);
135
+		};
136
+
137
+		$route->member_config_storage = Common::getvalue($params, 'member_config_storage');
138
+
139
+		// Make RouteParameters
140
+		if (isset($params['parameters'])) {
141
+			$route->parameters = new RouteParameters();
142
+			$route->parameters = RouteParameters::fromArray($params['parameters']);
143
+			Route4Me::setBaseUrl(EndpointV4::BASE_URL);
144
+		}
145
+
146
+		if (isset($params['addresses'])) {
147
+			$addresses = [];
148
+
149
+			foreach ($params['addresses'] as $address) {
150
+				$addresses[] = Address::fromArray($address);
151
+			}
152
+
153
+			$route->addresses = $addresses;
154
+		}
155
+
156
+		$route->links = Common::getValue($params, 'links', []);
157
+		$route->notes = Common::getValue($params, 'notes', []);
158
+		$route->directions = Common::getValue($params, 'directions', []);
159
+		$route->path = Common::getValue($params, 'path', []);
160
+		$route->tracking_history = Common::getValue($params, 'tracking_history', []);
161
+
162
+		if (isset($params['original_route'])) {
163
+			$route->original_route = Route::fromArray($params['original_route']);
164
+		};
165
+
166
+		return $route;
167
+	}
168
+
169
+	public static function getRoutes($params = null)
170
+	{
171
+		$allQueryFields = RouteParametersQuery::getAllProperties();
172
+
173
+		$result = Route4Me::makeRequst([
174
+			'url'       => Endpoint::Routes,
175
+			'method'    => 'GET',
176
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
177
+		]);
178
+
179
+		if (isset($params['route_id'])) {
180
+			if (strlen($params['route_id'])==32) {
181
+				return self::fromArray($result);
182
+			} else {
183
+				return $result;
184
+			}
185
+		} else {
186
+			$routes = [];
187
+			foreach ($result as $route) {
188
+				$routes[] = self::fromArray($route);
189
+			}
190
+
191
+			return $routes;
192
+		}
193
+	}
194
+
195
+	public function getAllRoutesWithPagination($params)
196
+	{
197
+		$allQueryFields = RouteParametersQuery::getAllProperties();
198
+
199
+		$result = Route4Me::makeRequst([
200
+			'url'       => Endpoint::RoutesPaginate,
201
+			'method'    => 'GET',
202
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
203
+		]);
204
+
205
+		return $result;
206
+	}
207
+
208
+	public function  getPaginatedRouteListWithoutElasticSearch($params)
209
+	{
210
+		$allQueryFields = RouteParametersQuery::getAllProperties();
211
+
212
+		$result = Route4Me::makeRequst([
213
+			'url'       => Endpoint::RoutesFallbackPaginate,
214
+			'method'    => 'GET',
215
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
216
+		]);
217
+
218
+		return $result;
219
+	}
220
+
221
+	public function getRouteDataTableWithoutElasticSearch($params)
222
+	{
223
+		$allBodyFields = ['query', 'filters', 'directions', 'notes', 'page',
224
+			'per_page', 'order_by', 'timezone'];
225
+
226
+		$result = Route4Me::makeRequst([
227
+			'url'           => Endpoint::RoutesFallbackDatatable,
228
+			'method'        => 'POST',
229
+			'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
230
+		]);
231
+
232
+		return $result;
233
+	}
234
+
235
+	public function getRouteDataTableWithElasticSearch($params)
236
+	{
237
+		$allBodyFields = ['query', 'filters', 'directions', 'notes', 'page',
238
+			'per_page', 'order_by', 'timezone'];
239
+
240
+		$result = Route4Me::makeRequst([
241
+			'url'           => Endpoint::RoutesDatatable,
242
+			'method'        => 'POST',
243
+			'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
244
+		]);
245
+
246
+		return $result;
247
+	}
248
+
249
+	public function getRouteListWithoutElasticSearch($params)
250
+	{
251
+		$allQueryFields = RouteParametersQuery::getAllProperties();
252
+
253
+		$result = Route4Me::makeRequst([
254
+			'url'       => Endpoint::RoutesFallback,
255
+			'method'    => 'GET',
256
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
257
+		]);
258
+
259
+		if (isset($params['route_id'])) {
260
+			if (strlen($params['route_id'])==32) {
261
+				return self::fromArray($result);
262
+			} else {
263
+				return $result;
264
+			}
265
+		} else {
266
+			$routes = [];
267
+			foreach ($result as $route) {
268
+				$routes[] = self::fromArray($route);
269
+			}
270
+
271
+			return $routes;
272
+		}
273
+	}
274
+
275
+	public function duplicateRoute($routeIDs)
276
+	{
277
+		$result = Route4Me::makeRequst([
278
+			'url'    => Endpoint::RoutesDuplicate,
279
+			'method' => 'POST',
280
+			'body'   => [
281
+				'duplicate_routes_id' => $routeIDs
282
+			],
283
+			'HTTPHEADER'    => 'Content-Type: application/json; Accept: application/json',
284
+		]);
285
+
286
+		return $result;
287
+	}
288
+
289
+	public function deleteRoutes($routeIDs)
290
+	{
291
+		$routeId = "";
292
+		foreach ($routeIDs as $rid) {
293
+			$routeId.=$rid.',';
294
+		}
295
+
296
+		$routeId = rtrim($routeId, ',');
297
+
298
+		$result = Route4Me::makeRequst([
299
+			'url'    => Endpoint::Routes,
300
+			'method' => 'DELETE',
301
+			'query'  => [
302
+				'route_id' => $routeId,
303
+			],
304
+		]);
305
+
306
+		return $result;
307
+	}
308
+
309
+	public function getRouteDataTableConfig()
310
+	{
311
+		$result = Route4Me::makeRequst([
312
+			'url'       => Endpoint::RoutesDatatableConfig,
313
+			'method'    => 'GET',
314
+			'query'     => null,
315
+		]);
316
+
317
+		return $result;
318
+	}
319
+
320
+	public function getRouteDataTableFallbackConfig()
321
+	{
322
+		$result = Route4Me::makeRequst([
323
+			'url'       => Endpoint::RoutesDatatableConfigFallback,
324
+			'method'    => 'GET',
325
+			'query'     => null,
326
+		]);
327
+
328
+		return $result;
329
+	}
330
+
331
+	public function updateRouteParameters($queryParams, $routeParams)
332
+	{
333
+		$allQueryFields = RouteParametersQuery::getAllProperties();
334
+		$allBodyFields = RouteParameters:: getAllProperties();
335
+
336
+		$bodyParams = ['parameters' => Route4Me::generateRequestParameters($allBodyFields, $routeParams)];
337
+
338
+		$result = Route4Me::makeRequst([
339
+			'url'       => Endpoint::Routes,
340
+			'method'    => 'PUT',
341
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $queryParams),
342
+			'body'      => $bodyParams,
343
+			'HTTPHEADER'    => 'Content-Type: application/json; Accept: application/json',
344
+		]);
345
+
346
+		return $result;
347
+	}
348
+
349
+
350
+
351
+
352
+	public function getRoutePoints($params)
353
+	{
354
+		$allQueryFields = ['route_id', 'route_path_output', 'compress_path_points', 'directions'];
355
+
356
+		$result = Route4Me::makeRequst([
357
+			'url'    => Endpoint::ROUTE_V4,
358
+			'method' => 'GET',
359
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
360
+		]);
361
+
362
+		return $result;
363
+	}
364
+
365
+
366
+
367
+	public function resequenceRoute($params)
368
+	{
369
+		$allQueryFields = ['route_id', 'route_destination_id'];
370
+		$allBodyFields = ['addresses'];
371
+
372
+		$result = Route4Me::makeRequst([
373
+			'url'       => Endpoint::ROUTE_V4,
374
+			'method'    => 'PUT',
375
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
376
+			'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
377
+		]);
378
+
379
+		return $result;
380
+	}
381
+
382
+	public function resequenceAllAddresses($params)
383
+	{
384
+		$allQueryFields = ['route_id', 'disable_optimization', 'optimize'];
385
+
386
+		$result = Route4Me::makeRequst([
387
+			'url'       => Endpoint::REOPTIMIZE_V3_2,
388
+			'method'    => 'GET',
389
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
390
+		]);
391
+
392
+		return $result;
393
+	}
394
+
395
+	public function mergeRoutes($params)
396
+	{
397
+		$allBodyFields = ['route_ids', 'depot_address', 'remove_origin', 'depot_lat',  'depot_lng'];
398
+
399
+		$result = Route4Me::makeRequst([
400
+			'url'           => Endpoint::ROUTES_MERGE,
401
+			'method'        => 'POST',
402
+			'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
403
+			'HTTPHEADER'    => 'Content-Type: multipart/form-data',
404
+		]);
405
+
406
+		return $result;
407
+	}
408
+
409
+	public function shareRoute($params)
410
+	{
411
+		$allQueryFields = ['route_id', 'response_format'];
412
+		$allBodyFields = ['recipient_email'];
413
+
414
+		$result = Route4Me::makeRequst([
415
+			'url'           => Endpoint::ROUTE_SHARE,
416
+			'method'        => 'POST',
417
+			'query'         => Route4Me::generateRequestParameters($allQueryFields, $params),
418
+			'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
419
+			'HTTPHEADER'    => 'Content-Type: multipart/form-data',
420
+		]);
421
+
422
+		return $result;
423
+	}
424
+
425
+	// Returns random route_id from existing routes between $offset and $offset+$limit
426
+	public function getRandomRouteId($offset, $limit)
427
+	{
428
+		$params = [
429
+			'offset'    => !is_null($offset) ? $offset : 0,
430
+			'limit'     => !is_null($limit) ? $limit : 30,
431
+		];
432
+
433
+		$route = new self();
434
+		$routes = $route->getRoutes($params);
435
+
436
+		if (is_null($routes) || sizeof($routes) < 1) {
437
+			echo '<br> There are no routes in the account. Please, create the routes first. <br>';
438
+
439
+			return null;
440
+		}
441
+
442
+		$randomIndex = rand(0, sizeof($routes) - 1);
443
+
444
+		return $routes[$randomIndex]->route_id;
445
+	}
446
+
447
+	public function updateRoute($params)
448
+	{
449
+		$allQueryFields = ['route_id', 'reoptimize','route_destination_id'];
450
+		$allBodyFields = ['addresses', 'parameters', 'unlink_from_master_optimization'];
451
+
452
+		$result = Route4Me::makeRequst([
453
+			'url'       => Endpoint::ROUTE_V4,
454
+			'method'    => 'PUT',
455
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
456
+			'body'      => (isset($params['addresses']) || isset($params['parameters']) || isset($params['unlink_from_master_optimization']))
457
+							? Route4Me::generateRequestParameters($allBodyFields, $params)
458
+							: null,
459
+		]);
460
+
461
+		return $result;
462
+	}
463
+
464
+	public function update()
465
+	{
466
+		$route = Route4Me::makeRequst([
467
+			'url'    => Endpoint::ROUTE_V4,
468
+			'method' => 'PUT',
469
+			'query'  => [
470
+				'route_id' => isset($this->route_id) ? $this->route_id : null,
471
+			],
472
+			'body'   => [
473
+				'parameters' => $this->parameters,
474
+				],
475
+			'HTTPHEADER' => isset($this->httpheaders) ? $this->httpheaders : null,
476
+		]);
477
+
478
+		return self::fromArray($route);
479
+	}
480
+
481
+	public function updateAddress($address = null)
482
+	{
483
+		$body = sizeof($this->addresses) < 1 ? get_object_vars($this->parameters)
484
+			: (isset($this->addresses[0]) ? $this->addresses[0] : get_object_vars($this->parameters));
485
+
486
+		$result = Route4Me::makeRequst([
487
+			'url'    => Endpoint::ADDRESS_V4,
488
+			'method' => 'PUT',
489
+			'query'  => [
490
+				'route_id' => isset($this->route_id) ? $this->route_id : null,
491
+				'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
492
+			],
493
+			'body'   => $body,
494
+			'HTTPHEADER' => isset($this->httpheaders) ? $this->httpheaders : null,
495
+		]);
496
+
497
+		return $result;
498
+	}
499
+
500
+	public function updateRouteAddress()
501
+	{
502
+		$result = Route4Me::makeRequst([
503
+			'url'    => Endpoint::ADDRESS_V4,
504
+			'method' => 'PUT',
505
+			'query'  => [
506
+				'route_id' => isset($this->route_id) ? $this->route_id : null,
507
+				'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
508
+			],
509
+			'body'   => [
510
+				'parameters' => isset($this->parameters) ? get_object_vars($this->parameters) : null,
511
+				'addresses' => isset($this->addresses) ? $this->addresses : null,
512
+			],
513
+			'HTTPHEADER' => isset($this->httpheaders) ? $this->httpheaders : null,
514
+		]);
515
+
516
+		return $result;
517
+	}
518
+
519
+	public function addAddresses($params)
520
+	{
521
+		$allQueryFields = ['route_id'];
522
+		$allBodyFields = ['addresses'];
523
+
524
+		$route = Route4Me::makeRequst([
525
+			'url'           => Endpoint::ROUTE_V4,
526
+			'method'        => 'PUT',
527
+			'query'         => Route4Me::generateRequestParameters($allQueryFields, $params),
528
+			'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
529
+			'HTTPHEADER'    => isset($this->httpheaders) ? $this->httpheaders : null,
530
+		]);
531
+
532
+		return self::fromArray($route);
533
+	}
534
+
535
+	public function insertAddressOptimalPosition(array $params)
536
+	{
537
+		$allQueryFields = ['route_id'];
538
+		$allBodyFields = ['addresses', 'optimal_position'];
539
+
540
+		$route = Route4Me::makeRequst([
541
+			'url'    => Endpoint::ROUTE_V4,
542
+			'method' => 'PUT',
543
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
544
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
545
+		]);
546
+
547
+		return self::fromArray($route);
548
+	}
549
+
550
+	public function addNoteFile($params)
551
+	{
552
+		$fname = isset($params['strFilename']) ? $params['strFilename'] : null;
553
+		$rpath = realpath($fname);
554
+
555
+		$allQueryFields = ['route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type'];
556
+		$allBodyFields = ['strUpdateType', 'strFilename', 'strNoteContents'];
557
+
558
+		$result = Route4Me::makeRequst([
559
+			'url'    => Endpoint::ROUTE_NOTES_ADD,
560
+			'method' => 'POST',
561
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
562
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
563
+			'FILE'   => $rpath,
564
+			'HTTPHEADER' => [
565
+				'Content-Type: application/x-www-form-urlencoded',
566
+			],
567
+		]);
568
+
569
+		return $result;
570
+	}
571
+
572
+
573
+
574
+	public function GetAddressesFromRoute($route_id)
575
+	{
576
+		$route1 = self::getRoutes(['route_id' => $route_id]);
577
+
578
+		if (isset($route1)) {
579
+			return $route1->addresses;
580
+		} else {
581
+			return null;
582
+		}
583
+	}
584
+
585
+	public function GetRandomAddressFromRoute($route_id)
586
+	{
587
+		$route1 = self::getRoutes(['route_id' => $route_id]);
588
+
589
+		if (isset($route1)) {
590
+			$addresses = $route1->addresses;
591
+
592
+			$rnd = rand(0, sizeof($addresses) - 1);
593
+
594
+			return $addresses[$rnd];
595
+		} else {
596
+			return null;
597
+		}
598
+	}
599
+
600
+	public function getRouteId()
601
+	{
602
+		return $this->route_id;
603
+	}
604
+
605
+	public function getOptimizationId()
606
+	{
607
+		return $this->optimization_problem_id;
608
+	}
609
+
610
+	public function GetLastLocation(array $params)
611
+	{
612
+		$allQueryFields = ['route_id', 'device_tracking_history'];
613
+
614
+		$route = Route4Me::makeRequst([
615
+			'url'    => Endpoint::ROUTE_V4,
616
+			'method' => 'GET',
617
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
618
+		]);
619
+
620
+		return self::fromArray($route);
621
+	}
622
+
623
+	public function GetTrackingHistoryFromTimeRange(array $params)
624
+	{
625
+		$allQueryFields = ['route_id', 'format', 'time_period', 'start_date', 'end_date'];
626
+
627
+		$route = Route4Me::makeRequst([
628
+			'url'    => Endpoint::GET_DEVICE_LOCATION,
629
+			'method' => 'GET',
630
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
631
+		]);
632
+
633
+		return $route;
634
+	}
635
+
636
+	public function GetAssetTracking(array $params)
637
+	{
638
+		$allQueryFields = ['tracking'];
639
+
640
+		$assetResponse = Route4Me::makeRequst([
641
+			'url'    => Endpoint::STATUS_V4,
642
+			'method' => 'GET',
643
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
644
+		]);
645
+
646
+		return $assetResponse;
647
+	}
648 648
 }
Please login to merge, or discard this patch.
src/Route4Me/V5/Routes/AddonRoutesApi/RouteFilterParametersFilters.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 
7 7
 class RouteFilterParametersFilters extends \Route4Me\Common
8 8
 {
9
-    /**
10
-     * @var string[] $schedule_date
11
-     */
12
-    public $schedule_date;
9
+	/**
10
+	 * @var string[] $schedule_date
11
+	 */
12
+	public $schedule_date;
13 13
 }
14 14
\ No newline at end of file
Please login to merge, or discard this patch.
src/Route4Me/V5/Routes/AddonRoutesApi/RouteFilterParameters.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -10,43 +10,43 @@
 block discarded – undo
10 10
  */
11 11
 class RouteFilterParameters extends \Route4Me\Common
12 12
 {
13
-    /**
14
-     * @var string $query
15
-     */
16
-    public $query;
17
-
18
-    /**
19
-     * @var RouteFilterParametersFilters $filters
20
-     */
21
-    public $filters = [];
22
-
23
-    /**
24
-     * @var boolean $directions
25
-     */
26
-    public $directions;
27
-
28
-    /**
29
-     * @var boolean $notes
30
-     */
31
-    public $notes;
32
-
33
-    /**
34
-     * @var integer $page
35
-     */
36
-    public $page;
37
-
38
-    /**
39
-     * @var integer $per_page
40
-     */
41
-    public $per_page;
42
-
43
-    /**
44
-     * @var array $order_by
45
-     */
46
-    public $order_by = [];
47
-
48
-    /**
49
-     * @var string $timezone
50
-     */
51
-    public $timezone;
13
+	/**
14
+	 * @var string $query
15
+	 */
16
+	public $query;
17
+
18
+	/**
19
+	 * @var RouteFilterParametersFilters $filters
20
+	 */
21
+	public $filters = [];
22
+
23
+	/**
24
+	 * @var boolean $directions
25
+	 */
26
+	public $directions;
27
+
28
+	/**
29
+	 * @var boolean $notes
30
+	 */
31
+	public $notes;
32
+
33
+	/**
34
+	 * @var integer $page
35
+	 */
36
+	public $page;
37
+
38
+	/**
39
+	 * @var integer $per_page
40
+	 */
41
+	public $per_page;
42
+
43
+	/**
44
+	 * @var array $order_by
45
+	 */
46
+	public $order_by = [];
47
+
48
+	/**
49
+	 * @var string $timezone
50
+	 */
51
+	public $timezone;
52 52
 }
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
src/Route4Me/V5/Enum/FuelConsumptionUnits.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@
 block discarded – undo
6 6
 /** Fuel consumption units enumeration. */
7 7
 class FuelConsumptionUnits
8 8
 {
9
-    const LITERS_PER_100_KILOMETERS = 'L/100km';
9
+	const LITERS_PER_100_KILOMETERS = 'L/100km';
10 10
 
11
-    const KILOMETERS_PER_LITER = 'km/l';
11
+	const KILOMETERS_PER_LITER = 'km/l';
12 12
 
13
-    const MILES_PER_GALLON_US = 'mpg';
13
+	const MILES_PER_GALLON_US = 'mpg';
14 14
 
15
-    const MILES_PER_GALLON_UK = 'mpg uk';
15
+	const MILES_PER_GALLON_UK = 'mpg uk';
16 16
 
17
-    const MILES_PER_LITER = 'mi/l';
17
+	const MILES_PER_LITER = 'mi/l';
18 18
 }
19 19
\ No newline at end of file
Please login to merge, or discard this patch.
src/Route4Me/V5/Enum/VehicleSizeUnits.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 /** Vehicle size (height, weidth, length) units. */
7 7
 class VehicleSizeUnits
8 8
 {
9
-    const METER = 'm';
9
+	const METER = 'm';
10 10
 
11
-    const FOOT = 'ft';
11
+	const FOOT = 'ft';
12 12
 }
13 13
\ No newline at end of file
Please login to merge, or discard this patch.