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 ( 6c805f...bce16d )
by Igor
09:12 queued 14s
created
src/Route4Me/V5/Members/DriverRatingApi/DriverReview.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -9,43 +9,43 @@
 block discarded – undo
9 9
  */
10 10
 class DriverReview extends \Route4Me\Common
11 11
 {
12
-    /** Driver Rating ID
13
-     * @var string $rating_id
14
-     */
15
-    public $rating_id;
16
-
17
-    /** The tracking number of the route destination
18
-     * @var string $tracking_number
19
-     */
20
-    public $tracking_number;
21
-
22
-    /**  review the driver got
23
-     * @var string $review
24
-     */
25
-    public $review;
26
-
27
-    /** The rating assigned to the driver.
28
-     * Available values: 1,2,3,4
29
-     * @var integer $rating
30
-     */
31
-    public $rating;
32
-
33
-    /** When the review was created.
34
-     * @var string $added_at
35
-     */
36
-    public $added_at;
37
-
38
-    public static function fromArray(array $params)
39
-    {
40
-        $driverReview = new self();
41
-
42
-        foreach ($params as $key => $value) {
43
-            if (property_exists($driverReview, $key)) {
44
-                $driverReview->{$key} = $value;
45
-            }
46
-        }
47
-
48
-        return $driverReview;
49
-    }
12
+	/** Driver Rating ID
13
+	 * @var string $rating_id
14
+	 */
15
+	public $rating_id;
16
+
17
+	/** The tracking number of the route destination
18
+	 * @var string $tracking_number
19
+	 */
20
+	public $tracking_number;
21
+
22
+	/**  review the driver got
23
+	 * @var string $review
24
+	 */
25
+	public $review;
26
+
27
+	/** The rating assigned to the driver.
28
+	 * Available values: 1,2,3,4
29
+	 * @var integer $rating
30
+	 */
31
+	public $rating;
32
+
33
+	/** When the review was created.
34
+	 * @var string $added_at
35
+	 */
36
+	public $added_at;
37
+
38
+	public static function fromArray(array $params)
39
+	{
40
+		$driverReview = new self();
41
+
42
+		foreach ($params as $key => $value) {
43
+			if (property_exists($driverReview, $key)) {
44
+				$driverReview->{$key} = $value;
45
+			}
46
+		}
47
+
48
+		return $driverReview;
49
+	}
50 50
 
51 51
 }
52 52
\ No newline at end of file
Please login to merge, or discard this patch.
src/Route4Me/V5/Members/TamManagementApi/TeamResponse.php 1 patch
Indentation   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -10,183 +10,183 @@
 block discarded – undo
10 10
  */
11 11
 class TeamResponse extends \Route4Me\Common
12 12
 {
13
-    /** The member ID
14
-     * @var integer $member_id
15
-     */
16
-    public $member_id;
17
-
18
-    /** The user's account owner ID
19
-     * @var integer $OWNER_MEMBER_ID
20
-     */
21
-    public $OWNER_MEMBER_ID;
22
-
23
-    /** User's first name
24
-     * @var string $member_first_name
25
-     */
26
-    public $member_first_name;
27
-
28
-    /** User's last name
29
-     * @var string $member_last_name
30
-     */
31
-    public $member_last_name;
32
-
33
-    /** User's email
34
-     * @var string $member_email
35
-     */
36
-    public $member_email;
37
-
38
-    /** User's phone number
39
-     * @var string $member_phone
40
-     */
41
-    public $member_phone;
42
-
43
-    /** Member's company name
44
-     * @var string $member_company
45
-     */
46
-    public $member_company;
47
-
48
-    /** Birthdate of the user.
49
-     * @var string $date_of_birth
50
-     */
51
-    public $date_of_birth;
52
-
53
-    /** Registration state ID of a user
54
-     * @var string $user_reg_state_id
55
-     */
56
-    public $user_reg_state_id;
57
-
58
-    /** Registration country ID of a user
59
-     * @var string $user_reg_country_id
60
-     */
61
-    public $user_reg_country_id;
62
-
63
-    /** A link to the user's picture
64
-     * @var string $member_picture
65
-     */
66
-    public $member_picture;
67
-
68
-    /** Member type. Available values:
69
-     * <para>PRIMARY_ACCOUNT, SUB_ACCOUNT_ADMIN, SUB_ACCOUNT_REGIONAL_MANAGER,</para>
70
-     * <para>SUB_ACCOUNT_DISPATCHER, SUB_ACCOUNT_PLANNER, SUB_ACCOUNT_DRIVER</para>
71
-     * @var string $member_type
72
-     */
73
-    public $member_type;
74
-
75
-    /** If true, the routed addresses will be hidden.
76
-     * @var boolean $HIDE_ROUTED_ADDRESSES
77
-     */
78
-    public $HIDE_ROUTED_ADDRESSES;
79
-
80
-    /** If true, the visited addresses will be hidden.
81
-     * @var boolean $HIDE_VISITED_ADDRESSES
82
-     */
83
-    public $HIDE_VISITED_ADDRESSES;
84
-
85
-    /** If true, the nonfuture routes will be hidden.
86
-     * @var boolean $HIDE_NONFUTURE_ROUTES
87
-     */
88
-    public $HIDE_NONFUTURE_ROUTES;
89
-
90
-    /** If true, the user has read-only access type.
91
-     * @var boolean $READONLY_USER
92
-     */
93
-    public $READONLY_USER;
94
-
95
-    /** If true, the global address book contacts
96
-     * are visible in a user account.
97
-     * @var boolean $SHOW_SUSR_ADDR
98
-     */
99
-    public $SHOW_SUSR_ADDR;
100
-
101
-    /** If true, the global orders are visible in a user account.
102
-     * @var boolean $SHOW_SUSR_ORDERS
103
-     */
104
-    public $SHOW_SUSR_ORDERS;
105
-
106
-    /** If true, all drivers are visible to the user.
107
-     * @var boolean $SHOW_ALL_DRIVERS
108
-     */
109
-    public $SHOW_ALL_DRIVERS;
110
-
111
-    /** If true, all vehicles are visible to the user.
112
-     * @var boolean $SHOW_ALL_VEHICLES
113
-     */
114
-    public $SHOW_ALL_VEHICLES;
115
-
116
-    /** Allowed sub-member types in the user's account.
117
-     * Available array item values:
118
-     * "SUB_ACCOUNT_DRIVER", "SUB_ACCOUNT_DISPATCHER", "SUB_ACCOUNT_PLANNER",
119
-     * "SUB_ACCOUNT_ANALYST", "SUB_ACCOUNT_ADMIN", "SUB_ACCOUNT_REGIONAL_MANAGER"
120
-     * @var string[] $allowed_submember_types
121
-     */
122
-    public $allowed_submember_types;
123
-
124
-    /** If true, the user can edit the account data.
125
-     * @var boolean $can_edit
126
-     */
127
-    public $can_edit;
128
-
129
-    /** If true, the user can delete the account data.
130
-     * @var boolean $can_delete
131
-     */
132
-    public $can_delete;
133
-
134
-    /** The user's custom data
135
-     * @var Array $custom_data
136
-     */
137
-    public $custom_data;
138
-
139
-    /** Hourly rate of a user
140
-     * @var double $DriverHourlyRate
141
-     */
142
-    public $DriverHourlyRate;
143
-
144
-    /** Vendor ID
145
-     * @var string $vendor_id
146
-     */
147
-    public $vendor_id;
148
-
149
-    /** Driving rate of a user.
150
-     * @var double $driving_rate
151
-     */
152
-    public $driving_rate;
153
-
154
-    /** Working rate of a user.
155
-     * @var double $working_rate
156
-     */
157
-    public $working_rate;
158
-
159
-    /** Mile rate of a user.
160
-     * @var double $mile_rate
161
-     */
162
-    public $mile_rate;
163
-
164
-    /** Mile rate of a user.
165
-     * @var double $idling_rate
166
-     */
167
-    public $idling_rate;
168
-
169
-    /** Display maximum_routes number of future days.
170
-     * @var integer $display_max_routes_future_days
171
-     */
172
-    public $display_max_routes_future_days;
173
-
174
-    /** Member's location timezone
175
-     * @var string $timezone
176
-     */
177
-    public $timezone;
178
-
179
-    public static function fromArray(array $params)
180
-    {
181
-        $teamtResponse = new self();
182
-
183
-        foreach ($params as $key => $value) {
184
-            if (property_exists($teamtResponse, $key)) {
185
-                $teamtResponse->{$key} = $value;
186
-            }
187
-        }
188
-
189
-        return $teamtResponse;
190
-    }
13
+	/** The member ID
14
+	 * @var integer $member_id
15
+	 */
16
+	public $member_id;
17
+
18
+	/** The user's account owner ID
19
+	 * @var integer $OWNER_MEMBER_ID
20
+	 */
21
+	public $OWNER_MEMBER_ID;
22
+
23
+	/** User's first name
24
+	 * @var string $member_first_name
25
+	 */
26
+	public $member_first_name;
27
+
28
+	/** User's last name
29
+	 * @var string $member_last_name
30
+	 */
31
+	public $member_last_name;
32
+
33
+	/** User's email
34
+	 * @var string $member_email
35
+	 */
36
+	public $member_email;
37
+
38
+	/** User's phone number
39
+	 * @var string $member_phone
40
+	 */
41
+	public $member_phone;
42
+
43
+	/** Member's company name
44
+	 * @var string $member_company
45
+	 */
46
+	public $member_company;
47
+
48
+	/** Birthdate of the user.
49
+	 * @var string $date_of_birth
50
+	 */
51
+	public $date_of_birth;
52
+
53
+	/** Registration state ID of a user
54
+	 * @var string $user_reg_state_id
55
+	 */
56
+	public $user_reg_state_id;
57
+
58
+	/** Registration country ID of a user
59
+	 * @var string $user_reg_country_id
60
+	 */
61
+	public $user_reg_country_id;
62
+
63
+	/** A link to the user's picture
64
+	 * @var string $member_picture
65
+	 */
66
+	public $member_picture;
67
+
68
+	/** Member type. Available values:
69
+	 * <para>PRIMARY_ACCOUNT, SUB_ACCOUNT_ADMIN, SUB_ACCOUNT_REGIONAL_MANAGER,</para>
70
+	 * <para>SUB_ACCOUNT_DISPATCHER, SUB_ACCOUNT_PLANNER, SUB_ACCOUNT_DRIVER</para>
71
+	 * @var string $member_type
72
+	 */
73
+	public $member_type;
74
+
75
+	/** If true, the routed addresses will be hidden.
76
+	 * @var boolean $HIDE_ROUTED_ADDRESSES
77
+	 */
78
+	public $HIDE_ROUTED_ADDRESSES;
79
+
80
+	/** If true, the visited addresses will be hidden.
81
+	 * @var boolean $HIDE_VISITED_ADDRESSES
82
+	 */
83
+	public $HIDE_VISITED_ADDRESSES;
84
+
85
+	/** If true, the nonfuture routes will be hidden.
86
+	 * @var boolean $HIDE_NONFUTURE_ROUTES
87
+	 */
88
+	public $HIDE_NONFUTURE_ROUTES;
89
+
90
+	/** If true, the user has read-only access type.
91
+	 * @var boolean $READONLY_USER
92
+	 */
93
+	public $READONLY_USER;
94
+
95
+	/** If true, the global address book contacts
96
+	 * are visible in a user account.
97
+	 * @var boolean $SHOW_SUSR_ADDR
98
+	 */
99
+	public $SHOW_SUSR_ADDR;
100
+
101
+	/** If true, the global orders are visible in a user account.
102
+	 * @var boolean $SHOW_SUSR_ORDERS
103
+	 */
104
+	public $SHOW_SUSR_ORDERS;
105
+
106
+	/** If true, all drivers are visible to the user.
107
+	 * @var boolean $SHOW_ALL_DRIVERS
108
+	 */
109
+	public $SHOW_ALL_DRIVERS;
110
+
111
+	/** If true, all vehicles are visible to the user.
112
+	 * @var boolean $SHOW_ALL_VEHICLES
113
+	 */
114
+	public $SHOW_ALL_VEHICLES;
115
+
116
+	/** Allowed sub-member types in the user's account.
117
+	 * Available array item values:
118
+	 * "SUB_ACCOUNT_DRIVER", "SUB_ACCOUNT_DISPATCHER", "SUB_ACCOUNT_PLANNER",
119
+	 * "SUB_ACCOUNT_ANALYST", "SUB_ACCOUNT_ADMIN", "SUB_ACCOUNT_REGIONAL_MANAGER"
120
+	 * @var string[] $allowed_submember_types
121
+	 */
122
+	public $allowed_submember_types;
123
+
124
+	/** If true, the user can edit the account data.
125
+	 * @var boolean $can_edit
126
+	 */
127
+	public $can_edit;
128
+
129
+	/** If true, the user can delete the account data.
130
+	 * @var boolean $can_delete
131
+	 */
132
+	public $can_delete;
133
+
134
+	/** The user's custom data
135
+	 * @var Array $custom_data
136
+	 */
137
+	public $custom_data;
138
+
139
+	/** Hourly rate of a user
140
+	 * @var double $DriverHourlyRate
141
+	 */
142
+	public $DriverHourlyRate;
143
+
144
+	/** Vendor ID
145
+	 * @var string $vendor_id
146
+	 */
147
+	public $vendor_id;
148
+
149
+	/** Driving rate of a user.
150
+	 * @var double $driving_rate
151
+	 */
152
+	public $driving_rate;
153
+
154
+	/** Working rate of a user.
155
+	 * @var double $working_rate
156
+	 */
157
+	public $working_rate;
158
+
159
+	/** Mile rate of a user.
160
+	 * @var double $mile_rate
161
+	 */
162
+	public $mile_rate;
163
+
164
+	/** Mile rate of a user.
165
+	 * @var double $idling_rate
166
+	 */
167
+	public $idling_rate;
168
+
169
+	/** Display maximum_routes number of future days.
170
+	 * @var integer $display_max_routes_future_days
171
+	 */
172
+	public $display_max_routes_future_days;
173
+
174
+	/** Member's location timezone
175
+	 * @var string $timezone
176
+	 */
177
+	public $timezone;
178
+
179
+	public static function fromArray(array $params)
180
+	{
181
+		$teamtResponse = new self();
182
+
183
+		foreach ($params as $key => $value) {
184
+			if (property_exists($teamtResponse, $key)) {
185
+				$teamtResponse->{$key} = $value;
186
+			}
187
+		}
188
+
189
+		return $teamtResponse;
190
+	}
191 191
 
192 192
 }
193 193
\ No newline at end of file
Please login to merge, or discard this patch.
src/Route4Me/V5/Routes/AddonRoutesApi/RouteDuplicateResponse.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -10,31 +10,31 @@
 block discarded – undo
10 10
  */
11 11
 class RouteDuplicateResponse extends \Route4Me\Common
12 12
 {
13
-    /** If true, the route duplicated successfully.
14
-     * @var boolean $status
15
-     */
16
-    public $status;
17
-
18
-    /** If true, the route duplication process was asynchronous.
19
-     * @var boolean $async
20
-     */
21
-    public $async;
22
-
23
-    /** An array of the duplicated route IDs.
24
-     * @var string[] $route_ids
25
-     */
26
-    public $route_ids = [];
27
-
28
-    public static function fromArray(array $params)
29
-    {
30
-        $duplicateResponse = new self();
31
-
32
-        foreach ($params as $key => $value) {
33
-            if (property_exists($duplicateResponse, $key)) {
34
-                $duplicateResponse->{$key} = $value;
35
-            }
36
-        }
37
-
38
-        return $duplicateResponse;
39
-    }
13
+	/** If true, the route duplicated successfully.
14
+	 * @var boolean $status
15
+	 */
16
+	public $status;
17
+
18
+	/** If true, the route duplication process was asynchronous.
19
+	 * @var boolean $async
20
+	 */
21
+	public $async;
22
+
23
+	/** An array of the duplicated route IDs.
24
+	 * @var string[] $route_ids
25
+	 */
26
+	public $route_ids = [];
27
+
28
+	public static function fromArray(array $params)
29
+	{
30
+		$duplicateResponse = new self();
31
+
32
+		foreach ($params as $key => $value) {
33
+			if (property_exists($duplicateResponse, $key)) {
34
+				$duplicateResponse->{$key} = $value;
35
+			}
36
+		}
37
+
38
+		return $duplicateResponse;
39
+	}
40 40
 }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
src/Route4Me/V5/Routes/AddonRoutesApi/RouteDataTableConfigResponse.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -9,26 +9,26 @@
 block discarded – undo
9 9
  */
10 10
 class RouteDataTableConfigResponse extends \Route4Me\Common
11 11
 {
12
-    /** API Capabilities
13
-     * @var ApiCapabilities $api_capabilities
14
-     */
15
-    public $api_capabilities = [];
12
+	/** API Capabilities
13
+	 * @var ApiCapabilities $api_capabilities
14
+	 */
15
+	public $api_capabilities = [];
16 16
 
17
-    /** API Preferences
18
-     * @var ApiPreferences $api_preferences
19
-     */
20
-    public $api_preferences = [];
17
+	/** API Preferences
18
+	 * @var ApiPreferences $api_preferences
19
+	 */
20
+	public $api_preferences = [];
21 21
 
22
-    public static function fromArray(array $params)
23
-    {
24
-        $configResponse = new self();
22
+	public static function fromArray(array $params)
23
+	{
24
+		$configResponse = new self();
25 25
 
26
-        foreach ($params as $key => $value) {
27
-            if (property_exists($configResponse, $key)) {
28
-                $configResponse->{$key} = $value;
29
-            }
30
-        }
26
+		foreach ($params as $key => $value) {
27
+			if (property_exists($configResponse, $key)) {
28
+				$configResponse->{$key} = $value;
29
+			}
30
+		}
31 31
 
32
-        return $configResponse;
33
-    }
32
+		return $configResponse;
33
+	}
34 34
 }
Please login to merge, or discard this patch.
src/Route4Me/V5/Routes/AddonRoutesApi/ApiCapabilities.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -6,41 +6,41 @@
 block discarded – undo
6 6
 
7 7
 class ApiCapabilities extends \Route4Me\Common
8 8
 {
9
-    /** Sortable Fields
10
-     * @var string[] $sortable_fields
11
-     */
12
-    public $sortable_fields = [];
13
-
14
-    /** Combinations of the sortable fields
15
-     * @var Array $sortable_fields_combinations
16
-     */
17
-    public $sortable_fields_combinations = [];
18
-
19
-    /** If true, multi-sorting enabled.
20
-     * @var boolean $multi_sorting_enabled
21
-     */
22
-    public $multi_sorting_enabled;
23
-
24
-    /** An array of the filterable fields.
25
-     * @var string[] $filterable_fields
26
-     */
27
-    public $filterable_fields = [];
28
-
29
-    /** If true, search enabled.
30
-     * @var boolean $search
31
-     */
32
-    public $search;
33
-
34
-    public static function fromArray(array $params)
35
-    {
36
-        $resultResponse = new self();
37
-
38
-        foreach ($params as $key => $value) {
39
-            if (property_exists($resultResponse, $key)) {
40
-                $resultResponse->{$key} = $value;
41
-            }
42
-        }
43
-
44
-        return $resultResponse;
45
-    }
9
+	/** Sortable Fields
10
+	 * @var string[] $sortable_fields
11
+	 */
12
+	public $sortable_fields = [];
13
+
14
+	/** Combinations of the sortable fields
15
+	 * @var Array $sortable_fields_combinations
16
+	 */
17
+	public $sortable_fields_combinations = [];
18
+
19
+	/** If true, multi-sorting enabled.
20
+	 * @var boolean $multi_sorting_enabled
21
+	 */
22
+	public $multi_sorting_enabled;
23
+
24
+	/** An array of the filterable fields.
25
+	 * @var string[] $filterable_fields
26
+	 */
27
+	public $filterable_fields = [];
28
+
29
+	/** If true, search enabled.
30
+	 * @var boolean $search
31
+	 */
32
+	public $search;
33
+
34
+	public static function fromArray(array $params)
35
+	{
36
+		$resultResponse = new self();
37
+
38
+		foreach ($params as $key => $value) {
39
+			if (property_exists($resultResponse, $key)) {
40
+				$resultResponse->{$key} = $value;
41
+			}
42
+		}
43
+
44
+		return $resultResponse;
45
+	}
46 46
 }
47 47
\ No newline at end of file
Please login to merge, or discard this patch.
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 2 patches
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.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -76,57 +76,57 @@  discard block
 block discarded – undo
76 76
     {
77 77
         $route = new self();
78 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');
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 130
 
131 131
         if (isset($params['vehicle'])) {
132 132
             $route->vehicle = new Vehicle();
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     {
291 291
         $routeId = "";
292 292
         foreach ($routeIDs as $rid) {
293
-            $routeId.=$rid.',';
293
+            $routeId .= $rid.',';
294 294
         }
295 295
 
296 296
         $routeId = rtrim($routeId, ',');
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 
395 395
     public function mergeRoutes($params)
396 396
     {
397
-        $allBodyFields = ['route_ids', 'depot_address', 'remove_origin', 'depot_lat',  'depot_lng'];
397
+        $allBodyFields = ['route_ids', 'depot_address', 'remove_origin', 'depot_lat', 'depot_lng'];
398 398
 
399 399
         $result = Route4Me::makeRequst([
400 400
             'url'           => Endpoint::ROUTES_MERGE,
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
         $route = new self();
434 434
         $routes = $route->getRoutes($params);
435 435
 
436
-        if (is_null($routes) || sizeof($routes) < 1) {
436
+        if (is_null($routes) || sizeof($routes)<1) {
437 437
             echo '<br> There are no routes in the account. Please, create the routes first. <br>';
438 438
 
439 439
             return null;
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 
447 447
     public function updateRoute($params)
448 448
     {
449
-        $allQueryFields = ['route_id', 'reoptimize','route_destination_id'];
449
+        $allQueryFields = ['route_id', 'reoptimize', 'route_destination_id'];
450 450
         $allBodyFields = ['addresses', 'parameters', 'unlink_from_master_optimization'];
451 451
 
452 452
         $result = Route4Me::makeRequst([
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 
481 481
     public function updateAddress($address = null)
482 482
     {
483
-        $body = sizeof($this->addresses) < 1 ? get_object_vars($this->parameters)
483
+        $body = sizeof($this->addresses)<1 ? get_object_vars($this->parameters)
484 484
             : (isset($this->addresses[0]) ? $this->addresses[0] : get_object_vars($this->parameters));
485 485
 
486 486
         $result = Route4Me::makeRequst([
Please login to merge, or discard this patch.