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 ( 5f270e...733b13 )
by Igor
09:47 queued 13s
created
src/Route4Me/V5/Routes/AddonRoutesApi/ApiPreferences.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -4,31 +4,31 @@
 block discarded – undo
4 4
 
5 5
 class ApiPreferences extends \Route4Me\Common
6 6
 {
7
-    /**
8
-     * @var boolean $force_server_side_search
9
-     */
10
-    public $force_server_side_search;
7
+	/**
8
+	 * @var boolean $force_server_side_search
9
+	 */
10
+	public $force_server_side_search;
11 11
 
12
-    /**
13
-     * @var boolean $partial_load
14
-     */
15
-    public $partial_load;
12
+	/**
13
+	 * @var boolean $partial_load
14
+	 */
15
+	public $partial_load;
16 16
 
17
-    /**
18
-     * @var boolean $simple_pagination
19
-     */
20
-    public $simple_pagination;
17
+	/**
18
+	 * @var boolean $simple_pagination
19
+	 */
20
+	public $simple_pagination;
21 21
 
22
-    public static function fromArray(array $params)
23
-    {
24
-        $apiPrefer = new self();
22
+	public static function fromArray(array $params)
23
+	{
24
+		$apiPrefer = new self();
25 25
 
26
-        foreach ($params as $key => $value) {
27
-            if (property_exists($apiPrefer, $key)) {
28
-                $apiPrefer->{$key} = $value;
29
-            }
30
-        }
26
+		foreach ($params as $key => $value) {
27
+			if (property_exists($apiPrefer, $key)) {
28
+				$apiPrefer->{$key} = $value;
29
+			}
30
+		}
31 31
 
32
-        return $apiPrefer;
33
-    }
32
+		return $apiPrefer;
33
+	}
34 34
 }
35 35
\ No newline at end of file
Please login to merge, or discard this patch.
src/Route4Me/V5/Routes/AddonRoutesApi/RouteParametersQuery.php 1 patch
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -12,154 +12,154 @@
 block discarded – undo
12 12
  */
13 13
 class RouteParametersQuery extends Common
14 14
 {
15
-    /** Route IDs concatenated with a comma
16
-     * @var string $route_id
17
-     */
18
-    public $route_id;
19
-
20
-    /** Require Route directions in the results.
21
-     * @var boolean $directions
22
-     */
23
-    public $directions;
24
-
25
-    /** Path output style.
26
-     * Available values:
27
-     * - Points;
28
-     * - Encoded;
29
-     * - None.
30
-     * @var string $route_path_output
31
-     */
32
-    public $route_path_output;
33
-
34
-    /** Output route tracking data in response
35
-     * @var boolean $device_tracking_history
36
-     */
37
-    public $device_tracking_history;
38
-
39
-    /** Limit of the queried records number.
40
-     * @var integer $limit
41
-     */
42
-    public $limit;
43
-
44
-    /** Offset from the beginning of the queried records.
45
-     * @var integer $offset
46
-     */
47
-    public $offset;
48
-
49
-    /** Start timestamp of the date range
50
-     * @var integer $start_date
51
-     */
52
-    public $start_date;
53
-
54
-    /** End timestamp of the date range.
55
-     * @var integer $end_date
56
-     */
57
-    public $end_date;
58
-
59
-    /** Output addresses and directions in the original optimization request sequence.
60
-     * This is to allow us to compare routes before & after optimization.
61
-     * @var boolean $original
62
-     */
63
-    public $original;
64
-
65
-    /** Require Route notes in the results.
66
-     * @var boolean $notes
67
-     */
68
-    public $notes;
69
-
70
-    /** Require Order Inventories in the results.
71
-     * @var boolean $order_inventory
72
-     */
73
-    public $order_inventory;
74
-
75
-    /** If true, not visited destinations of an active route re-optimized (re-sequenced).
76
-     * @var boolean $remaining
77
-     */
78
-    public $remaining;
79
-
80
-    /** Search the query for a Route
81
-     * @var string $query
82
-     */
83
-    public $query;
84
-
85
-    /** Updating a route supports the reoptimize=1 parameter,
86
-     * which reoptimizes only that route.
87
-     * Also supports the parameters from GET.
88
-     * @var boolean $reoptimize
89
-     */
90
-    public $reoptimize;
91
-
92
-    /** Whether disable or not a route optimization.
93
-     * @var boolean $disable_optimization
94
-     */
95
-    public $disable_optimization;
96
-
97
-    /** The driving directions will be generated biased for this selection. This has no impact on route sequencing.
98
-     * <para>Available values: </para>
99
-     * <value>'Distance', 'Time', 'timeWithTraffic'.</value>
100
-     * <remarks><para>Query parameter.</para></remarks>
101
-     * @var string $optimize
102
-     */
103
-    public $optimize;
104
-
105
-    /** By sending recompute_directions=1 we request that the route directions
106
-     * be recomputed (note that this does happen automatically if certain properties
107
-     * of the route are updated, such as stop sequence_no changes or round-tripness)
108
-     * @var boolean $recompute_directions
109
-     */
110
-    public $recompute_directions;
111
-
112
-    /** Response format('json', 'csv', 'xml')
113
-     * @var string $response_format
114
-     */
115
-    public $response_format;
116
-
117
-    /** Route destination ID
118
-     * @var integer $route_destination_id
119
-     */
120
-    public $route_destination_id;
121
-
122
-    /**
123
-     * @var boolean $redirect
124
-     */
125
-    public $redirect;
126
-
127
-    /** Require bundled Items in the results.
128
-     * @var boolean $bundling_items
129
-     */
130
-    public $bundling_items;
131
-
132
-    /** Requested page.
133
-     * @var integer $page
134
-     */
135
-    public $page;
136
-
137
-    /** Number of Routes per page.
138
-     * @var integer $per_page
139
-     */
140
-    public $per_page;
141
-
142
-
143
-    public static function fromArray(array $params)
144
-    {
145
-        $routeQueryParams = new self();
146
-
147
-        foreach ($params as $key => $value) {
148
-            if (property_exists($routeQueryParams, $key)) {
149
-                $routeQueryParams->{$key} = $value;
150
-            }
151
-        }
152
-
153
-        return $routeQueryParams;
154
-    }
155
-
156
-    public static function getAllProperties()
157
-    {
158
-        $routeQueryParams = new self();
159
-
160
-        $fields = array_keys(get_object_vars($routeQueryParams));
161
-
162
-        return $fields;
163
-    }
15
+	/** Route IDs concatenated with a comma
16
+	 * @var string $route_id
17
+	 */
18
+	public $route_id;
19
+
20
+	/** Require Route directions in the results.
21
+	 * @var boolean $directions
22
+	 */
23
+	public $directions;
24
+
25
+	/** Path output style.
26
+	 * Available values:
27
+	 * - Points;
28
+	 * - Encoded;
29
+	 * - None.
30
+	 * @var string $route_path_output
31
+	 */
32
+	public $route_path_output;
33
+
34
+	/** Output route tracking data in response
35
+	 * @var boolean $device_tracking_history
36
+	 */
37
+	public $device_tracking_history;
38
+
39
+	/** Limit of the queried records number.
40
+	 * @var integer $limit
41
+	 */
42
+	public $limit;
43
+
44
+	/** Offset from the beginning of the queried records.
45
+	 * @var integer $offset
46
+	 */
47
+	public $offset;
48
+
49
+	/** Start timestamp of the date range
50
+	 * @var integer $start_date
51
+	 */
52
+	public $start_date;
53
+
54
+	/** End timestamp of the date range.
55
+	 * @var integer $end_date
56
+	 */
57
+	public $end_date;
58
+
59
+	/** Output addresses and directions in the original optimization request sequence.
60
+	 * This is to allow us to compare routes before & after optimization.
61
+	 * @var boolean $original
62
+	 */
63
+	public $original;
64
+
65
+	/** Require Route notes in the results.
66
+	 * @var boolean $notes
67
+	 */
68
+	public $notes;
69
+
70
+	/** Require Order Inventories in the results.
71
+	 * @var boolean $order_inventory
72
+	 */
73
+	public $order_inventory;
74
+
75
+	/** If true, not visited destinations of an active route re-optimized (re-sequenced).
76
+	 * @var boolean $remaining
77
+	 */
78
+	public $remaining;
79
+
80
+	/** Search the query for a Route
81
+	 * @var string $query
82
+	 */
83
+	public $query;
84
+
85
+	/** Updating a route supports the reoptimize=1 parameter,
86
+	 * which reoptimizes only that route.
87
+	 * Also supports the parameters from GET.
88
+	 * @var boolean $reoptimize
89
+	 */
90
+	public $reoptimize;
91
+
92
+	/** Whether disable or not a route optimization.
93
+	 * @var boolean $disable_optimization
94
+	 */
95
+	public $disable_optimization;
96
+
97
+	/** The driving directions will be generated biased for this selection. This has no impact on route sequencing.
98
+	 * <para>Available values: </para>
99
+	 * <value>'Distance', 'Time', 'timeWithTraffic'.</value>
100
+	 * <remarks><para>Query parameter.</para></remarks>
101
+	 * @var string $optimize
102
+	 */
103
+	public $optimize;
104
+
105
+	/** By sending recompute_directions=1 we request that the route directions
106
+	 * be recomputed (note that this does happen automatically if certain properties
107
+	 * of the route are updated, such as stop sequence_no changes or round-tripness)
108
+	 * @var boolean $recompute_directions
109
+	 */
110
+	public $recompute_directions;
111
+
112
+	/** Response format('json', 'csv', 'xml')
113
+	 * @var string $response_format
114
+	 */
115
+	public $response_format;
116
+
117
+	/** Route destination ID
118
+	 * @var integer $route_destination_id
119
+	 */
120
+	public $route_destination_id;
121
+
122
+	/**
123
+	 * @var boolean $redirect
124
+	 */
125
+	public $redirect;
126
+
127
+	/** Require bundled Items in the results.
128
+	 * @var boolean $bundling_items
129
+	 */
130
+	public $bundling_items;
131
+
132
+	/** Requested page.
133
+	 * @var integer $page
134
+	 */
135
+	public $page;
136
+
137
+	/** Number of Routes per page.
138
+	 * @var integer $per_page
139
+	 */
140
+	public $per_page;
141
+
142
+
143
+	public static function fromArray(array $params)
144
+	{
145
+		$routeQueryParams = new self();
146
+
147
+		foreach ($params as $key => $value) {
148
+			if (property_exists($routeQueryParams, $key)) {
149
+				$routeQueryParams->{$key} = $value;
150
+			}
151
+		}
152
+
153
+		return $routeQueryParams;
154
+	}
155
+
156
+	public static function getAllProperties()
157
+	{
158
+		$routeQueryParams = new self();
159
+
160
+		$fields = array_keys(get_object_vars($routeQueryParams));
161
+
162
+		return $fields;
163
+	}
164 164
 
165 165
 }
166 166
\ No newline at end of file
Please login to merge, or discard this patch.
src/Route4Me/V5/Routes/AddonRoutesApi/RoutesDeleteResponse.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -10,36 +10,36 @@
 block discarded – undo
10 10
  */
11 11
 class RoutesDeleteResponse extends \Route4Me\Common
12 12
 {
13
-    /** If true, the route duplicated successfully.
14
-     * @var boolean $deleted
15
-     */
16
-    public $deleted;
17
-
18
-    /** If true, the route duplication process was asynchronous.
19
-     * @var bool $async
20
-     */
21
-    public $async;
22
-
23
-    /** Route ID
24
-     * @var string $route_id
25
-     */
26
-    public $route_id;
27
-
28
-    /** An array of the duplicated route IDs.
29
-     * @var string[] $route_ids
30
-     */
31
-    public $route_ids;
32
-
33
-    public static function fromArray(array $params)
34
-    {
35
-        $deleteResponse = new self();
36
-
37
-        foreach ($params as $key => $value) {
38
-            if (property_exists($deleteResponse, $key)) {
39
-                $deleteResponse->{$key} = $value;
40
-            }
41
-        }
42
-
43
-        return $deleteResponse;
44
-    }
13
+	/** If true, the route duplicated successfully.
14
+	 * @var boolean $deleted
15
+	 */
16
+	public $deleted;
17
+
18
+	/** If true, the route duplication process was asynchronous.
19
+	 * @var bool $async
20
+	 */
21
+	public $async;
22
+
23
+	/** Route ID
24
+	 * @var string $route_id
25
+	 */
26
+	public $route_id;
27
+
28
+	/** An array of the duplicated route IDs.
29
+	 * @var string[] $route_ids
30
+	 */
31
+	public $route_ids;
32
+
33
+	public static function fromArray(array $params)
34
+	{
35
+		$deleteResponse = new self();
36
+
37
+		foreach ($params as $key => $value) {
38
+			if (property_exists($deleteResponse, $key)) {
39
+				$deleteResponse->{$key} = $value;
40
+			}
41
+		}
42
+
43
+		return $deleteResponse;
44
+	}
45 45
 }
46 46
\ 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/Routes/RouteParameters.php 1 patch
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -7,101 +7,101 @@
 block discarded – undo
7 7
 
8 8
 class RouteParameters extends Common
9 9
 {
10
-    public $is_upload;
11
-    public $rt;
12
-    public $route_name;
13
-    public $route_date;
14
-    public $shared_publicly;
15
-    public $disable_optimization;
16
-    public $optimize;
17
-    public $lock_last;
18
-    public $vehicle_capacity;
19
-    public $vehicle_max_cargo_weight;
20
-    public $vehicle_max_cargo_volume;
21
-    public $vehicle_max_distance_mi;
22
-    public $subtour_max_revenue;
23
-    public $distance_unit;
24
-    public $travel_mode;
25
-    public $avoid;
26
-    public $avoidance_zones = [];
27
-    public $vehicle_id;
28
-    public $driver_id;
29
-    public $dev_lat;
30
-    public $dev_lng;
31
-    public $route_max_duration;
32
-    public $route_email;
33
-    public $store_route;
34
-    public $metric;
35
-    public $algorithm_type;
36
-    public $member_id;
37
-    public $ip;
38
-    public $dm;
39
-    public $dirm;
40
-    public $parts;
41
-    public $parts_min;
42
-    public $device_id;
43
-    public $device_type;
44
-    public $first_drive_then_wait_between_stops;
45
-    public $has_trailer;
46
-    public $trailer_weight_t;
47
-    public $limited_weight_t;
48
-    public $weight_per_axle_t;
49
-    public $truck_height;
50
-    public $truck_width;
51
-    public $truck_length;
52
-    public $truck_hazardous_goods;
53
-    public $truck_axles;
54
-    public $truck_toll_road_usage;
55
-    public $truck_avoid_ferries;
56
-    public $truck_hwy_only;
57
-    public $truck_lcv;
58
-    public $truck_borders;
59
-    public $truck_side_street_adherence;
60
-    public $truck_config;
61
-    public $truck_dim_unit;
62
-    public $truck_type;
63
-    public $truck_weight;
64
-    public $optimization_quality;
65
-    public $override_addresses = [];
66
-    public $max_tour_size;
67
-    public $min_tour_size;
68
-    public $uturn;
69
-    public $leftturn;
70
-    public $rightturn;
71
-    public $route_time_multiplier;
72
-    public $route_service_time_multiplier;
73
-    public $optimization_engine;
74
-    public $is_dynamic_start_time;
75
-    public $bundling;
10
+	public $is_upload;
11
+	public $rt;
12
+	public $route_name;
13
+	public $route_date;
14
+	public $shared_publicly;
15
+	public $disable_optimization;
16
+	public $optimize;
17
+	public $lock_last;
18
+	public $vehicle_capacity;
19
+	public $vehicle_max_cargo_weight;
20
+	public $vehicle_max_cargo_volume;
21
+	public $vehicle_max_distance_mi;
22
+	public $subtour_max_revenue;
23
+	public $distance_unit;
24
+	public $travel_mode;
25
+	public $avoid;
26
+	public $avoidance_zones = [];
27
+	public $vehicle_id;
28
+	public $driver_id;
29
+	public $dev_lat;
30
+	public $dev_lng;
31
+	public $route_max_duration;
32
+	public $route_email;
33
+	public $store_route;
34
+	public $metric;
35
+	public $algorithm_type;
36
+	public $member_id;
37
+	public $ip;
38
+	public $dm;
39
+	public $dirm;
40
+	public $parts;
41
+	public $parts_min;
42
+	public $device_id;
43
+	public $device_type;
44
+	public $first_drive_then_wait_between_stops;
45
+	public $has_trailer;
46
+	public $trailer_weight_t;
47
+	public $limited_weight_t;
48
+	public $weight_per_axle_t;
49
+	public $truck_height;
50
+	public $truck_width;
51
+	public $truck_length;
52
+	public $truck_hazardous_goods;
53
+	public $truck_axles;
54
+	public $truck_toll_road_usage;
55
+	public $truck_avoid_ferries;
56
+	public $truck_hwy_only;
57
+	public $truck_lcv;
58
+	public $truck_borders;
59
+	public $truck_side_street_adherence;
60
+	public $truck_config;
61
+	public $truck_dim_unit;
62
+	public $truck_type;
63
+	public $truck_weight;
64
+	public $optimization_quality;
65
+	public $override_addresses = [];
66
+	public $max_tour_size;
67
+	public $min_tour_size;
68
+	public $uturn;
69
+	public $leftturn;
70
+	public $rightturn;
71
+	public $route_time_multiplier;
72
+	public $route_service_time_multiplier;
73
+	public $optimization_engine;
74
+	public $is_dynamic_start_time;
75
+	public $bundling;
76 76
 
77
-    public static function fromArray(array $params)
78
-    {
79
-        $routeParams = new self();
80
-        foreach ($params as $key => $value) {
81
-            if (property_exists($routeParams, $key)) {
82
-                $routeParams->{$key} = $value;
83
-            }
84
-        }
77
+	public static function fromArray(array $params)
78
+	{
79
+		$routeParams = new self();
80
+		foreach ($params as $key => $value) {
81
+			if (property_exists($routeParams, $key)) {
82
+				$routeParams->{$key} = $value;
83
+			}
84
+		}
85 85
 
86
-        return $routeParams;
87
-    }
86
+		return $routeParams;
87
+	}
88 88
 
89
-    public function setAddressBundle($addressBundle)
90
-    {
91
-        $this->bundling = $addressBundle;
92
-    }
89
+	public function setAddressBundle($addressBundle)
90
+	{
91
+		$this->bundling = $addressBundle;
92
+	}
93 93
 
94
-    public function getAddressBundle()
95
-    {
96
-        return $this->bundling;
97
-    }
94
+	public function getAddressBundle()
95
+	{
96
+		return $this->bundling;
97
+	}
98 98
 
99
-    public static function getAllProperties()
100
-    {
101
-        $routeParams = new self();
99
+	public static function getAllProperties()
100
+	{
101
+		$routeParams = new self();
102 102
 
103
-        $fields = array_keys(get_object_vars($routeParams));
103
+		$fields = array_keys(get_object_vars($routeParams));
104 104
 
105
-        return $fields;
106
-    }
105
+		return $fields;
106
+	}
107 107
 }
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.