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 ( d9a634...e591c7 )
by Juan Jose
07:17 queued 16s
created
src/Route4Me/V5/RecurringRoutes/RouteSchedule.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -13,30 +13,30 @@
 block discarded – undo
13 13
  */
14 14
 class RouteSchedule extends Common
15 15
 {
16
-    /**
17
-     * The Route ID
18
-     */
19
-    public ?string $route_id = null;
16
+	/**
17
+	 * The Route ID
18
+	 */
19
+	public ?string $route_id = null;
20 20
 
21
-    /**
22
-     * The Schedule ID
23
-     */
24
-    public ?string $schedule_uid = null;
21
+	/**
22
+	 * The Schedule ID
23
+	 */
24
+	public ?string $schedule_uid = null;
25 25
 
26
-    /**
27
-     * The Schedule ID
28
-     */
29
-    public ?int $member_id = null;
26
+	/**
27
+	 * The Schedule ID
28
+	 */
29
+	public ?int $member_id = null;
30 30
 
31
-    /**
32
-     * The Schedule ID
33
-     */
34
-    public ?string $vehicle_id = null;
31
+	/**
32
+	 * The Schedule ID
33
+	 */
34
+	public ?string $vehicle_id = null;
35 35
 
36
-    public function __construct(?array $params = null)
37
-    {
38
-        if ($params !== null) {
39
-            $this->fillFromArray($params);
40
-        }
41
-    }
36
+	public function __construct(?array $params = null)
37
+	{
38
+		if ($params !== null) {
39
+			$this->fillFromArray($params);
40
+		}
41
+	}
42 42
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 
36 36
     public function __construct(?array $params = null)
37 37
     {
38
-        if ($params !== null) {
38
+        if ($params!==null) {
39 39
             $this->fillFromArray($params);
40 40
         }
41 41
     }
Please login to merge, or discard this patch.
src/Route4Me/V5/RecurringRoutes/PageInfo.php 2 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -13,72 +13,72 @@
 block discarded – undo
13 13
  */
14 14
 class PageInfo extends Common
15 15
 {
16
-    /**
17
-     * URL of first page
18
-     */
19
-    public ?string $url_of_first_page = null;
16
+	/**
17
+	 * URL of first page
18
+	 */
19
+	public ?string $url_of_first_page = null;
20 20
 
21
-    /**
22
-     * URL of last page
23
-     */
24
-    public ?string $url_of_last_page = null;
21
+	/**
22
+	 * URL of last page
23
+	 */
24
+	public ?string $url_of_last_page = null;
25 25
 
26
-    /**
27
-     * URL of previous page
28
-     */
29
-    public ?string $url_of_previous_page = null;
26
+	/**
27
+	 * URL of previous page
28
+	 */
29
+	public ?string $url_of_previous_page = null;
30 30
 
31
-    /**
32
-     * URL of next page
33
-     */
34
-    public ?string $url_of_next_page = null;
31
+	/**
32
+	 * URL of next page
33
+	 */
34
+	public ?string $url_of_next_page = null;
35 35
 
36
-    /**
37
-     * Number of current page
38
-     */
39
-    public ?int $number_of_current_page = null;
36
+	/**
37
+	 * Number of current page
38
+	 */
39
+	public ?int $number_of_current_page = null;
40 40
 
41
-    /**
42
-     * Number of last page
43
-     */
44
-    public ?int $number_of_last_page = null;
41
+	/**
42
+	 * Number of last page
43
+	 */
44
+	public ?int $number_of_last_page = null;
45 45
 
46
-    /**
47
-     * Items per page
48
-     */
49
-    public ?int $items_per_page = null;
46
+	/**
47
+	 * Items per page
48
+	 */
49
+	public ?int $items_per_page = null;
50 50
 
51
-    /**
52
-     * Index of first item on page
53
-     */
54
-    public ?int $index_of_first = null;
51
+	/**
52
+	 * Index of first item on page
53
+	 */
54
+	public ?int $index_of_first = null;
55 55
 
56
-    /**
57
-     * Index of last item on page
58
-     */
59
-    public ?int $index_of_last = null;
56
+	/**
57
+	 * Index of last item on page
58
+	 */
59
+	public ?int $index_of_last = null;
60 60
 
61
-    /**
62
-     * Total items
63
-     */
64
-    public ?int $total_items = null;
61
+	/**
62
+	 * Total items
63
+	 */
64
+	public ?int $total_items = null;
65 65
 
66
-    public function __construct(array $links = null, array $meta = null)
67
-    {
68
-        if ($links !== null && is_array($links)) {
69
-            $this->url_of_first_page = Common::getValue($links, 'first');
70
-            $this->url_of_last_page = Common::getValue($links, 'last');
71
-            $this->url_of_previous_page = Common::getValue($links, 'prev');
72
-            $this->url_of_next_page = Common::getValue($links, 'next');
73
-        }
66
+	public function __construct(array $links = null, array $meta = null)
67
+	{
68
+		if ($links !== null && is_array($links)) {
69
+			$this->url_of_first_page = Common::getValue($links, 'first');
70
+			$this->url_of_last_page = Common::getValue($links, 'last');
71
+			$this->url_of_previous_page = Common::getValue($links, 'prev');
72
+			$this->url_of_next_page = Common::getValue($links, 'next');
73
+		}
74 74
 
75
-        if ($meta !== null && is_array($meta)) {
76
-            $this->number_of_current_page = Common::getValue($meta, 'current_page');
77
-            $this->number_of_last_page = Common::getValue($meta, 'last_page');
78
-            $this->items_per_page = Common::getValue($meta, 'per_page');
79
-            $this->index_of_first = Common::getValue($meta, 'from');
80
-            $this->index_of_last = Common::getValue($meta, 'to');
81
-            $this->total_items = Common::getValue($meta, 'total');
82
-        }
83
-    }
75
+		if ($meta !== null && is_array($meta)) {
76
+			$this->number_of_current_page = Common::getValue($meta, 'current_page');
77
+			$this->number_of_last_page = Common::getValue($meta, 'last_page');
78
+			$this->items_per_page = Common::getValue($meta, 'per_page');
79
+			$this->index_of_first = Common::getValue($meta, 'from');
80
+			$this->index_of_last = Common::getValue($meta, 'to');
81
+			$this->total_items = Common::getValue($meta, 'total');
82
+		}
83
+	}
84 84
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,14 +65,14 @@
 block discarded – undo
65 65
 
66 66
     public function __construct(array $links = null, array $meta = null)
67 67
     {
68
-        if ($links !== null && is_array($links)) {
68
+        if ($links!==null && is_array($links)) {
69 69
             $this->url_of_first_page = Common::getValue($links, 'first');
70 70
             $this->url_of_last_page = Common::getValue($links, 'last');
71 71
             $this->url_of_previous_page = Common::getValue($links, 'prev');
72 72
             $this->url_of_next_page = Common::getValue($links, 'next');
73 73
         }
74 74
 
75
-        if ($meta !== null && is_array($meta)) {
75
+        if ($meta!==null && is_array($meta)) {
76 76
             $this->number_of_current_page = Common::getValue($meta, 'current_page');
77 77
             $this->number_of_last_page = Common::getValue($meta, 'last_page');
78 78
             $this->items_per_page = Common::getValue($meta, 'per_page');
Please login to merge, or discard this patch.
src/Route4Me/V5/RecurringRoutes/Schedule.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -13,40 +13,40 @@
 block discarded – undo
13 13
  */
14 14
 class Schedule extends Common
15 15
 {
16
-    /**
17
-     * The Schedule ID
18
-     */
19
-    public ?string $schedule_uid = null;
20
-
21
-    /**
22
-     * The name of Schedule
23
-     */
24
-    public ?string $name = null;
25
-
26
-    /**
27
-     * Array of blacklisted dates as string 'YYYY-MM-DD'.
28
-     */
29
-    public ?array $schedule_blacklist = null;
30
-
31
-    public int $advance_interval = 1;
32
-
33
-    public int $advance_schedule_interval_days = 0;
34
-
35
-    /**
36
-     * Schedule as JSON string
37
-     * e.g. '{"enabled":true,"mode":"daily","daily":{"every":2}, "from":"2019-06-05","timestamp":1558538737}'
38
-     */
39
-    public ?string $schedule = null;
40
-
41
-    /**
42
-     * Timezone as 'America/New_York'.
43
-     */
44
-    public ?string $timezone = null;
45
-
46
-    public function __construct(?array $params = null)
47
-    {
48
-        if ($params !== null) {
49
-            $this->fillFromArray($params);
50
-        }
51
-    }
16
+	/**
17
+	 * The Schedule ID
18
+	 */
19
+	public ?string $schedule_uid = null;
20
+
21
+	/**
22
+	 * The name of Schedule
23
+	 */
24
+	public ?string $name = null;
25
+
26
+	/**
27
+	 * Array of blacklisted dates as string 'YYYY-MM-DD'.
28
+	 */
29
+	public ?array $schedule_blacklist = null;
30
+
31
+	public int $advance_interval = 1;
32
+
33
+	public int $advance_schedule_interval_days = 0;
34
+
35
+	/**
36
+	 * Schedule as JSON string
37
+	 * e.g. '{"enabled":true,"mode":"daily","daily":{"every":2}, "from":"2019-06-05","timestamp":1558538737}'
38
+	 */
39
+	public ?string $schedule = null;
40
+
41
+	/**
42
+	 * Timezone as 'America/New_York'.
43
+	 */
44
+	public ?string $timezone = null;
45
+
46
+	public function __construct(?array $params = null)
47
+	{
48
+		if ($params !== null) {
49
+			$this->fillFromArray($params);
50
+		}
51
+	}
52 52
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 
36 36
     public function __construct(?array $params = null)
37 37
     {
38
-        if ($params !== null) {
38
+        if ($params!==null) {
39 39
             $this->fillFromArray($params);
40 40
         }
41 41
     }
Please login to merge, or discard this patch.
src/Route4Me/Exception/ApiError.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -4,16 +4,16 @@
 block discarded – undo
4 4
 
5 5
 class ApiError extends \Exception
6 6
 {
7
-    protected string $source = '';
7
+	protected string $source = '';
8 8
 
9
-    public function __construct(string $message = '', int $code = 0, string $source = '', \Throwable $previous = null)
10
-    {
11
-        parent::__construct($message, $code, $previous);
12
-        $this->source = $source;
13
-    }
9
+	public function __construct(string $message = '', int $code = 0, string $source = '', \Throwable $previous = null)
10
+	{
11
+		parent::__construct($message, $code, $previous);
12
+		$this->source = $source;
13
+	}
14 14
 
15
-    final public function getSource() : string
16
-    {
17
-        return $this->source;
18
-    }
15
+	final public function getSource() : string
16
+	{
17
+		return $this->source;
18
+	}
19 19
 }
Please login to merge, or discard this patch.
src/Route4Me/V5/Vehicles/DataTypes/Vehicle.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -235,7 +235,7 @@
 block discarded – undo
235 235
         $vehicleId = $vehicleParams['vehicle_id'];
236 236
 
237 237
         $response = Route4Me::makeRequst([
238
-            'url' => Endpoint::Vehicles . '/' . $vehicleId,
238
+            'url' => Endpoint::Vehicles.'/'.$vehicleId,
239 239
             'method' => 'DELETE'
240 240
         ]);
241 241
 
Please login to merge, or discard this patch.
Indentation   +390 added lines, -390 removed lines patch added patch discarded remove patch
@@ -18,394 +18,394 @@
 block discarded – undo
18 18
  */
19 19
 class Vehicle extends Common
20 20
 {
21
-    /** The vehicle ID
22
-     * @var string $vehicle_id
23
-     */
24
-    public $vehicle_id;
25
-
26
-    /** Member ID assigned to the vehicle.
27
-     * @var integer $member_id
28
-     */
29
-    public $member_id;
30
-
31
-    /** If true, the vehicle is marked as deleted.
32
-     * @var boolean $is_deleted
33
-     */
34
-    public $is_deleted;
35
-
36
-    /** Vehicle alias
37
-     * @var string $vehicle_alias
38
-     */
39
-    public $vehicle_alias;
40
-
41
-    /** Vehicle VIN
42
-     * @var string $vehicle_vin
43
-     */
44
-    public $vehicle_vin;
45
-
46
-    /** Vehicle registration state ID.
47
-     * @var integer $vehicle_reg_state_id
48
-     */
49
-    public $vehicle_reg_state_id;
50
-
51
-    /** Vehicle registration country ID.
52
-     * @var integer $vehicle_reg_country_id
53
-     */
54
-    public $vehicle_reg_country_id;
55
-
56
-    /** A license plate of the vehicle.
57
-     * @var string $vehicle_license_plate
58
-     */
59
-    public $vehicle_license_plate;
60
-
61
-    /** Vehicle type.
62
-     * <para>Availbale values:</para>
63
-     * sedan', 'suv', 'pickup_truck', 'van', '18wheeler', 'cabin', 'hatchback',
64
-     * '<para>motorcyle', 'waste_disposal', 'tree_cutting', 'bigrig', 'cement_mixer', </para>
65
-     * 'livestock_carrier', 'dairy','tractor_trailer'.
66
-     * @var string $vehicle_type_id
67
-     */
68
-    public $vehicle_type_id;
69
-
70
-    /** When the vehicle was added.
71
-     * @var string $timestamp_added
72
-     */
73
-    public $timestamp_added;
74
-
75
-    /** Vehicle maker brend.
76
-     * <para>Available values:</para>
77
-     * "american coleman", "bmw", "chevrolet", "ford", "freightliner", "gmc",
78
-     * <para>"hino", "honda", "isuzu", "kenworth", "mack", "mercedes-benz", "mitsubishi", </para>
79
-     * "navistar", "nissan", "peterbilt", "renault", "scania", "sterling", "toyota",
80
-     * <para>"volvo", "western star" </para>
81
-     * </value>"
82
-     * @var string $vehicle_make
83
-     */
84
-    public $vehicle_make;
85
-
86
-    /** Vehicle model year
87
-     * @var integer $vehicle_model_year
88
-     */
89
-    public $vehicle_model_year;
90
-
91
-    /** Vehicle model
92
-     * @var string $vehicle_model
93
-     */
94
-    public $vehicle_model;
95
-
96
-    /** The year, vehicle was acquired
97
-     * @var integer $vehicle_year_acquired
98
-     */
99
-    public $vehicle_year_acquired;
100
-
101
-    /** A cost of the new vehicle
102
-     * @var float $vehicle_cost_new
103
-     */
104
-    public $vehicle_cost_new;
105
-
106
-    /** If true, the vehicle was purchased new.
107
-     * @var boolean $purchased_new
108
-     */
109
-    public $purchased_new;
110
-
111
-    /** Start date of the license
112
-     * @var string $license_start_date
113
-     */
114
-    public $license_start_date;
115
-
116
-    /** End date of the license
117
-     * @var string $license_end_date
118
-     */
119
-    public $license_end_date;
120
-
121
-    /** If equal to '1', the vehicle is operational.
122
-     * @var boolean $is_operational
123
-     */
124
-    public $is_operational;
125
-
126
-    /** A type of the fuel
127
-     * @var string $fuel_type
128
-     * enum: ['unleaded 87','unleaded 89','unleaded 91','unleaded 93','diesel','electric','hybrid']
129
-     */
130
-    public $fuel_type;
131
-
132
-    /** External telematics vehicle IDs
133
-     * @var integer $external_telematics_vehicle_ids
134
-     */
135
-    public $external_telematics_vehicle_id;
136
-
137
-    /** When the vehcile was marked as deleted.
138
-     * @var integer $timestamp_removed
139
-     */
140
-    public $timestamp_removed;
141
-
142
-    /** Vehicle profile ID
143
-     * @var integer $vehicle_profile_id
144
-     */
145
-    public $vehicle_profile_id;
146
-
147
-    /** Fuel consumption city
148
-     * @var float $fuel_consumption_city
149
-     */
150
-    public $fuel_consumption_city;
151
-
152
-    /** Fuel consumption in the highway area
153
-     * @var float $fuel_consumption_highway
154
-     */
155
-    public $fuel_consumption_highway;
156
-
157
-    /** Fuel consumption units in the city area (e.g. mi/l)
158
-     * @var string $fuel_consumption_city_unit
159
-     */
160
-    public $fuel_consumption_city_unit;
161
-
162
-    /** Fuel consumption units in the highway area (e.g. mi/l)
163
-     * @var string $fuel_consumption_highway_unit
164
-     */
165
-    public $fuel_consumption_highway_unit;
166
-
167
-    /** Miles per gallon in the city area
168
-     * @var float $mpg_city
169
-     */
170
-    public $mpg_city;
171
-
172
-    /** Miles per gallon in the highway area
173
-     * @var float $mpg_highway
174
-     */
175
-    public $mpg_highway;
176
-
177
-    /** Fuel consumption UF value in the city area (e.g. '20.01 mi/l')
178
-     * @var string $fuel_consumption_city_uf_value
179
-     */
180
-    public $fuel_consumption_city_uf_value;
181
-
182
-    /** Fuel consumption UF value in the highway area (e.g. '2,000.01 mpg')
183
-     * @var string $fuel_consumption_highway_uf_value
184
-     */
185
-    public $fuel_consumption_highway_uf_value;
186
-
187
-    public static function fromArray(array $params)
188
-    {
189
-        $vehicle = new self();
190
-
191
-        foreach ($params as $key => $value) {
192
-            if (is_null(Common::getValue($params, $key))) {
193
-                continue;
194
-            }
195
-            if (property_exists($vehicle, $key)) {
196
-                $vehicle->$key = $value;
197
-            }
198
-        }
199
-
200
-        return $vehicle;
201
-    }
202
-
203
-    public function __construct()
204
-    {
205
-        Route4Me::setBaseUrl("");
206
-    }
207
-
208
-    /** Creates a vehicle
209
-     * @param  $vehicleParams - an array of vehicle's parameters or Vehicle object
210
-     * @return array          - a vehicle object or failure info.
211
-     */
212
-    public function createVehicle($vehicleParams)
213
-    {
214
-        $excludeFields = ['vehicle_id', 'is_deleted', 'created_time', 'timestamp_added', 'timestamp_removed'];
215
-        $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields);
216
-
217
-        $response = Route4Me::makeRequst([
218
-            'url' => Endpoint::Vehicles,
219
-            'method' => 'POST',
220
-            'body' => Route4Me::generateRequestParameters($allBodyFields, $vehicleParams),
221
-            'HTTPHEADERS' => ['Content-Type: application/json', 'Accept: application/json']
222
-        ]);
223
-
224
-        return $response;
225
-    }
226
-
227
-    /** Removes a vehicle by specified vehicle ID.
228
-     * @param  string $vehicleID - Vehicle ID
229
-     * @return array             - an array of parameers of removed vehicle object.
230
-     * @throws \Route4Me\Exception\ApiError
231
-     */
232
-    public function removeVehicle($vehicleParams)
233
-    {
234
-        $vehicleId = $vehicleParams['vehicle_id'];
235
-
236
-        $response = Route4Me::makeRequst([
237
-            'url' => Endpoint::Vehicles . '/' . $vehicleId,
238
-            'method' => 'DELETE'
239
-        ]);
240
-
241
-        return $response;
242
-    }
243
-
244
-    /** Returns the VehiclesPaginated type object containing an array of the vehicles.
245
-     * @param  $params - an array of pagginated parameters or VehicleParameters object.
246
-     * @return array   - an array of the Vehicle objects.
247
-     * @throws \Route4Me\Exception\ApiError
248
-     */
249
-    public function getVehiclesPaginatedList($params)
250
-    {
251
-        $allQueryFields = ['with_pagination', 'page', 'perPage'];
252
-
253
-        $response = Route4Me::makeRequst([
254
-            'url' => Endpoint::Vehicles,
255
-            'method' => 'GET',
256
-            'query' => Route4Me::generateRequestParameters($allQueryFields, $params),
257
-        ]);
258
-
259
-        return $response;
260
-    }
261
-
262
-    /** Creates temporary vehicle in the database.
263
-     * @param  $vehicleParams - an array of parameters or VehicleTemporary object.
264
-     * @return array          - an array of parameters of VehicleTemporary.
265
-     * @throws \Route4Me\Exception\ApiError
266
-     */
267
-    public function createTemporaryVehicle($vehicleParams)
268
-    {
269
-        $excludeFields = [];
270
-        $allBodyFields = Route4Me::getObjectProperties(new VehicleTemporary(), $excludeFields);
271
-
272
-        $response = Route4Me::makeRequst([
273
-            'url' => Endpoint::VehicleTemporary,
274
-            'method' => 'POST',
275
-            'body' => Route4Me::generateRequestParameters($allBodyFields, $vehicleParams),
276
-            'HTTPHEADERS' => ['Content-Type: application/json', 'Accept: application/json']
277
-        ]);
278
-
279
-        return $response;
280
-    }
281
-
282
-    /** Execute a vehicle order.
283
-     * @param  $vehicleParams - an array of order parameters or VehicleOrderParameters object
284
-     * @return array          - an array of parameters of VehicleOrderResponse.
285
-     * @throws \Route4Me\Exception\ApiError
286
-     */
287
-    public function executeVehicleOrder($vehicleParams)
288
-    {
289
-        $excludeFields = [];
290
-        $allBodyFields = Route4Me::getObjectProperties(new VehicleOrderParameters(), $excludeFields);
291
-
292
-        $response = Route4Me::makeRequst([
293
-            'url' => Endpoint::VehicleExecuteOrder,
294
-            'method' => 'POST',
295
-            'body' => Route4Me::generateRequestParameters($allBodyFields, $vehicleParams),
296
-            'HTTPHEADERS' => ['Content-Type: application/json', 'Accept: application/json']
297
-        ]);
298
-
299
-        return $response;
300
-    }
301
-
302
-    /** Get latest vehicle locations by specified vehicle IDs.
303
-     * @param  $vehicleParams - Vehicle query parameters containing vehicle IDs
304
-     * @return array          - Data with vehicles
305
-     * @throws \Route4Me\Exception\ApiError
306
-     */
307
-    public function getVehicleLocations($vehicleParams)
308
-    {
309
-        $allQueryFields = ['ids'];
310
-
311
-        $response = Route4Me::makeRequst([
312
-            'url' => Endpoint::VehicleLocation,
313
-            'method' => 'GET',
314
-            'query' => Route4Me::generateRequestParameters($allQueryFields, $vehicleParams),
315
-        ]);
316
-
317
-        return $response;
318
-    }
319
-
320
-    /** Get the Vehicle by specifying vehicle ID.
321
-     * @param  $vehicleParams - Vehicle query parameters containing vehicle ID.
322
-     * @return array          - an array of parameters of Vehicle.
323
-     * @throws \Route4Me\Exception\ApiError
324
-     */
325
-    public function getVehicleById($vehicleParams)
326
-    {
327
-        $allQueryFields = ['vehicle_id'];
328
-
329
-        $response = Route4Me::makeRequst([
330
-            'url' => Endpoint::Vehicles.'/'.$vehicleParams['vehicle_id'],
331
-            'method' => 'GET',
332
-            'query' => null,
333
-        ]);
334
-
335
-        return $response;
336
-    }
337
-
338
-    /** Get the Vehicle track by specifying vehicle ID.
339
-     * @param  $vehicleParams - Vehicle query parameters containing vehicle ID.
340
-     * @return array          - an array of parameters of VehicleTrackResponse.
341
-     * @throws \Route4Me\Exception\ApiError
342
-     */
343
-    public function getVehicleTrack($vehicleParams)
344
-    {
345
-        $response = Route4Me::makeRequst([
346
-            'url' => Endpoint::Vehicles.'/'.$vehicleParams['vehicle_id'].'/track',
347
-            'method' => 'GET',
348
-            'query' => null,
349
-        ]);
350
-
351
-        return $response;
352
-    }
353
-
354
-    /** Get the Vehicle Profile by license plate.
355
-     * @param  $vehicleParams - Vehicle query parameters containing 'vehicle_license_plate'.
356
-     * @return array          - an array of parameters of Vehicle
357
-     * @throws \Route4Me\Exception\ApiError
358
-     */
359
-    public function getVehicleByLicensePlate($vehicleParams)
360
-    {
361
-        $allQueryFields = ['vehicle_license_plate'];
362
-
363
-        $response = Route4Me::makeRequst([
364
-            'url' => Endpoint::VehicleLicense,
365
-            'method' => 'GET',
366
-            'query' => Route4Me::generateRequestParameters($allQueryFields, $vehicleParams),
367
-        ]);
368
-
369
-        return $response;
370
-    }
371
-
372
-    /** Search for the Vehicle by sending the corresponding body payload.
373
-     * @param  $searchParams - query parameters or VehicleSearchParameters object.
374
-     * @return array         - an array of Vehicles
375
-     * @throws \Route4Me\Exception\ApiError
376
-     */
377
-    public function searchVehicles($searchParams)
378
-    {
379
-        $excludeFields = [];
380
-        $allBodyFields = Route4Me::getObjectProperties(new VehicleSearchParameters(), $excludeFields);
381
-
382
-        $response = Route4Me::makeRequst([
383
-            'url' => Endpoint::VehicleSearch,
384
-            'method' => 'POST',
385
-            'body' => Route4Me::generateRequestParameters($allBodyFields, $searchParams),
386
-            'HTTPHEADERS' => ['Content-Type: application/json', 'Accept: application/json']
387
-        ]);
388
-
389
-        return $response;
390
-    }
391
-
392
-    /** Update the Vehicle Profile by specifying the path parameter ID and by sending.
393
-     * @param  $vehicleParams - an array of vehicle's parameters or Vehicle object.
394
-     * @return array          - an array of parameters of Vehicle
395
-     * @throws \Route4Me\Exception\ApiError
396
-     */
397
-    public function updateVehicle($vehicleParams)
398
-    {
399
-        $excludeFields = ['vehicle_id', 'is_deleted', 'created_time', 'timestamp_added', 'timestamp_removed'];
400
-        $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields);
401
-
402
-        $response = Route4Me::makeRequst([
403
-            'url' => Endpoint::Vehicles.'/'.$vehicleParams['vehicle_id'],
404
-            'method' => 'PATCH',
405
-            'body' => Route4Me::generateRequestParameters($allBodyFields, $vehicleParams),
406
-            'HTTPHEADER' => 'Content-Type: application/json'
407
-        ]);
408
-
409
-        return $response;
410
-    }
21
+	/** The vehicle ID
22
+	 * @var string $vehicle_id
23
+	 */
24
+	public $vehicle_id;
25
+
26
+	/** Member ID assigned to the vehicle.
27
+	 * @var integer $member_id
28
+	 */
29
+	public $member_id;
30
+
31
+	/** If true, the vehicle is marked as deleted.
32
+	 * @var boolean $is_deleted
33
+	 */
34
+	public $is_deleted;
35
+
36
+	/** Vehicle alias
37
+	 * @var string $vehicle_alias
38
+	 */
39
+	public $vehicle_alias;
40
+
41
+	/** Vehicle VIN
42
+	 * @var string $vehicle_vin
43
+	 */
44
+	public $vehicle_vin;
45
+
46
+	/** Vehicle registration state ID.
47
+	 * @var integer $vehicle_reg_state_id
48
+	 */
49
+	public $vehicle_reg_state_id;
50
+
51
+	/** Vehicle registration country ID.
52
+	 * @var integer $vehicle_reg_country_id
53
+	 */
54
+	public $vehicle_reg_country_id;
55
+
56
+	/** A license plate of the vehicle.
57
+	 * @var string $vehicle_license_plate
58
+	 */
59
+	public $vehicle_license_plate;
60
+
61
+	/** Vehicle type.
62
+	 * <para>Availbale values:</para>
63
+	 * sedan', 'suv', 'pickup_truck', 'van', '18wheeler', 'cabin', 'hatchback',
64
+	 * '<para>motorcyle', 'waste_disposal', 'tree_cutting', 'bigrig', 'cement_mixer', </para>
65
+	 * 'livestock_carrier', 'dairy','tractor_trailer'.
66
+	 * @var string $vehicle_type_id
67
+	 */
68
+	public $vehicle_type_id;
69
+
70
+	/** When the vehicle was added.
71
+	 * @var string $timestamp_added
72
+	 */
73
+	public $timestamp_added;
74
+
75
+	/** Vehicle maker brend.
76
+	 * <para>Available values:</para>
77
+	 * "american coleman", "bmw", "chevrolet", "ford", "freightliner", "gmc",
78
+	 * <para>"hino", "honda", "isuzu", "kenworth", "mack", "mercedes-benz", "mitsubishi", </para>
79
+	 * "navistar", "nissan", "peterbilt", "renault", "scania", "sterling", "toyota",
80
+	 * <para>"volvo", "western star" </para>
81
+	 * </value>"
82
+	 * @var string $vehicle_make
83
+	 */
84
+	public $vehicle_make;
85
+
86
+	/** Vehicle model year
87
+	 * @var integer $vehicle_model_year
88
+	 */
89
+	public $vehicle_model_year;
90
+
91
+	/** Vehicle model
92
+	 * @var string $vehicle_model
93
+	 */
94
+	public $vehicle_model;
95
+
96
+	/** The year, vehicle was acquired
97
+	 * @var integer $vehicle_year_acquired
98
+	 */
99
+	public $vehicle_year_acquired;
100
+
101
+	/** A cost of the new vehicle
102
+	 * @var float $vehicle_cost_new
103
+	 */
104
+	public $vehicle_cost_new;
105
+
106
+	/** If true, the vehicle was purchased new.
107
+	 * @var boolean $purchased_new
108
+	 */
109
+	public $purchased_new;
110
+
111
+	/** Start date of the license
112
+	 * @var string $license_start_date
113
+	 */
114
+	public $license_start_date;
115
+
116
+	/** End date of the license
117
+	 * @var string $license_end_date
118
+	 */
119
+	public $license_end_date;
120
+
121
+	/** If equal to '1', the vehicle is operational.
122
+	 * @var boolean $is_operational
123
+	 */
124
+	public $is_operational;
125
+
126
+	/** A type of the fuel
127
+	 * @var string $fuel_type
128
+	 * enum: ['unleaded 87','unleaded 89','unleaded 91','unleaded 93','diesel','electric','hybrid']
129
+	 */
130
+	public $fuel_type;
131
+
132
+	/** External telematics vehicle IDs
133
+	 * @var integer $external_telematics_vehicle_ids
134
+	 */
135
+	public $external_telematics_vehicle_id;
136
+
137
+	/** When the vehcile was marked as deleted.
138
+	 * @var integer $timestamp_removed
139
+	 */
140
+	public $timestamp_removed;
141
+
142
+	/** Vehicle profile ID
143
+	 * @var integer $vehicle_profile_id
144
+	 */
145
+	public $vehicle_profile_id;
146
+
147
+	/** Fuel consumption city
148
+	 * @var float $fuel_consumption_city
149
+	 */
150
+	public $fuel_consumption_city;
151
+
152
+	/** Fuel consumption in the highway area
153
+	 * @var float $fuel_consumption_highway
154
+	 */
155
+	public $fuel_consumption_highway;
156
+
157
+	/** Fuel consumption units in the city area (e.g. mi/l)
158
+	 * @var string $fuel_consumption_city_unit
159
+	 */
160
+	public $fuel_consumption_city_unit;
161
+
162
+	/** Fuel consumption units in the highway area (e.g. mi/l)
163
+	 * @var string $fuel_consumption_highway_unit
164
+	 */
165
+	public $fuel_consumption_highway_unit;
166
+
167
+	/** Miles per gallon in the city area
168
+	 * @var float $mpg_city
169
+	 */
170
+	public $mpg_city;
171
+
172
+	/** Miles per gallon in the highway area
173
+	 * @var float $mpg_highway
174
+	 */
175
+	public $mpg_highway;
176
+
177
+	/** Fuel consumption UF value in the city area (e.g. '20.01 mi/l')
178
+	 * @var string $fuel_consumption_city_uf_value
179
+	 */
180
+	public $fuel_consumption_city_uf_value;
181
+
182
+	/** Fuel consumption UF value in the highway area (e.g. '2,000.01 mpg')
183
+	 * @var string $fuel_consumption_highway_uf_value
184
+	 */
185
+	public $fuel_consumption_highway_uf_value;
186
+
187
+	public static function fromArray(array $params)
188
+	{
189
+		$vehicle = new self();
190
+
191
+		foreach ($params as $key => $value) {
192
+			if (is_null(Common::getValue($params, $key))) {
193
+				continue;
194
+			}
195
+			if (property_exists($vehicle, $key)) {
196
+				$vehicle->$key = $value;
197
+			}
198
+		}
199
+
200
+		return $vehicle;
201
+	}
202
+
203
+	public function __construct()
204
+	{
205
+		Route4Me::setBaseUrl("");
206
+	}
207
+
208
+	/** Creates a vehicle
209
+	 * @param  $vehicleParams - an array of vehicle's parameters or Vehicle object
210
+	 * @return array          - a vehicle object or failure info.
211
+	 */
212
+	public function createVehicle($vehicleParams)
213
+	{
214
+		$excludeFields = ['vehicle_id', 'is_deleted', 'created_time', 'timestamp_added', 'timestamp_removed'];
215
+		$allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields);
216
+
217
+		$response = Route4Me::makeRequst([
218
+			'url' => Endpoint::Vehicles,
219
+			'method' => 'POST',
220
+			'body' => Route4Me::generateRequestParameters($allBodyFields, $vehicleParams),
221
+			'HTTPHEADERS' => ['Content-Type: application/json', 'Accept: application/json']
222
+		]);
223
+
224
+		return $response;
225
+	}
226
+
227
+	/** Removes a vehicle by specified vehicle ID.
228
+	 * @param  string $vehicleID - Vehicle ID
229
+	 * @return array             - an array of parameers of removed vehicle object.
230
+	 * @throws \Route4Me\Exception\ApiError
231
+	 */
232
+	public function removeVehicle($vehicleParams)
233
+	{
234
+		$vehicleId = $vehicleParams['vehicle_id'];
235
+
236
+		$response = Route4Me::makeRequst([
237
+			'url' => Endpoint::Vehicles . '/' . $vehicleId,
238
+			'method' => 'DELETE'
239
+		]);
240
+
241
+		return $response;
242
+	}
243
+
244
+	/** Returns the VehiclesPaginated type object containing an array of the vehicles.
245
+	 * @param  $params - an array of pagginated parameters or VehicleParameters object.
246
+	 * @return array   - an array of the Vehicle objects.
247
+	 * @throws \Route4Me\Exception\ApiError
248
+	 */
249
+	public function getVehiclesPaginatedList($params)
250
+	{
251
+		$allQueryFields = ['with_pagination', 'page', 'perPage'];
252
+
253
+		$response = Route4Me::makeRequst([
254
+			'url' => Endpoint::Vehicles,
255
+			'method' => 'GET',
256
+			'query' => Route4Me::generateRequestParameters($allQueryFields, $params),
257
+		]);
258
+
259
+		return $response;
260
+	}
261
+
262
+	/** Creates temporary vehicle in the database.
263
+	 * @param  $vehicleParams - an array of parameters or VehicleTemporary object.
264
+	 * @return array          - an array of parameters of VehicleTemporary.
265
+	 * @throws \Route4Me\Exception\ApiError
266
+	 */
267
+	public function createTemporaryVehicle($vehicleParams)
268
+	{
269
+		$excludeFields = [];
270
+		$allBodyFields = Route4Me::getObjectProperties(new VehicleTemporary(), $excludeFields);
271
+
272
+		$response = Route4Me::makeRequst([
273
+			'url' => Endpoint::VehicleTemporary,
274
+			'method' => 'POST',
275
+			'body' => Route4Me::generateRequestParameters($allBodyFields, $vehicleParams),
276
+			'HTTPHEADERS' => ['Content-Type: application/json', 'Accept: application/json']
277
+		]);
278
+
279
+		return $response;
280
+	}
281
+
282
+	/** Execute a vehicle order.
283
+	 * @param  $vehicleParams - an array of order parameters or VehicleOrderParameters object
284
+	 * @return array          - an array of parameters of VehicleOrderResponse.
285
+	 * @throws \Route4Me\Exception\ApiError
286
+	 */
287
+	public function executeVehicleOrder($vehicleParams)
288
+	{
289
+		$excludeFields = [];
290
+		$allBodyFields = Route4Me::getObjectProperties(new VehicleOrderParameters(), $excludeFields);
291
+
292
+		$response = Route4Me::makeRequst([
293
+			'url' => Endpoint::VehicleExecuteOrder,
294
+			'method' => 'POST',
295
+			'body' => Route4Me::generateRequestParameters($allBodyFields, $vehicleParams),
296
+			'HTTPHEADERS' => ['Content-Type: application/json', 'Accept: application/json']
297
+		]);
298
+
299
+		return $response;
300
+	}
301
+
302
+	/** Get latest vehicle locations by specified vehicle IDs.
303
+	 * @param  $vehicleParams - Vehicle query parameters containing vehicle IDs
304
+	 * @return array          - Data with vehicles
305
+	 * @throws \Route4Me\Exception\ApiError
306
+	 */
307
+	public function getVehicleLocations($vehicleParams)
308
+	{
309
+		$allQueryFields = ['ids'];
310
+
311
+		$response = Route4Me::makeRequst([
312
+			'url' => Endpoint::VehicleLocation,
313
+			'method' => 'GET',
314
+			'query' => Route4Me::generateRequestParameters($allQueryFields, $vehicleParams),
315
+		]);
316
+
317
+		return $response;
318
+	}
319
+
320
+	/** Get the Vehicle by specifying vehicle ID.
321
+	 * @param  $vehicleParams - Vehicle query parameters containing vehicle ID.
322
+	 * @return array          - an array of parameters of Vehicle.
323
+	 * @throws \Route4Me\Exception\ApiError
324
+	 */
325
+	public function getVehicleById($vehicleParams)
326
+	{
327
+		$allQueryFields = ['vehicle_id'];
328
+
329
+		$response = Route4Me::makeRequst([
330
+			'url' => Endpoint::Vehicles.'/'.$vehicleParams['vehicle_id'],
331
+			'method' => 'GET',
332
+			'query' => null,
333
+		]);
334
+
335
+		return $response;
336
+	}
337
+
338
+	/** Get the Vehicle track by specifying vehicle ID.
339
+	 * @param  $vehicleParams - Vehicle query parameters containing vehicle ID.
340
+	 * @return array          - an array of parameters of VehicleTrackResponse.
341
+	 * @throws \Route4Me\Exception\ApiError
342
+	 */
343
+	public function getVehicleTrack($vehicleParams)
344
+	{
345
+		$response = Route4Me::makeRequst([
346
+			'url' => Endpoint::Vehicles.'/'.$vehicleParams['vehicle_id'].'/track',
347
+			'method' => 'GET',
348
+			'query' => null,
349
+		]);
350
+
351
+		return $response;
352
+	}
353
+
354
+	/** Get the Vehicle Profile by license plate.
355
+	 * @param  $vehicleParams - Vehicle query parameters containing 'vehicle_license_plate'.
356
+	 * @return array          - an array of parameters of Vehicle
357
+	 * @throws \Route4Me\Exception\ApiError
358
+	 */
359
+	public function getVehicleByLicensePlate($vehicleParams)
360
+	{
361
+		$allQueryFields = ['vehicle_license_plate'];
362
+
363
+		$response = Route4Me::makeRequst([
364
+			'url' => Endpoint::VehicleLicense,
365
+			'method' => 'GET',
366
+			'query' => Route4Me::generateRequestParameters($allQueryFields, $vehicleParams),
367
+		]);
368
+
369
+		return $response;
370
+	}
371
+
372
+	/** Search for the Vehicle by sending the corresponding body payload.
373
+	 * @param  $searchParams - query parameters or VehicleSearchParameters object.
374
+	 * @return array         - an array of Vehicles
375
+	 * @throws \Route4Me\Exception\ApiError
376
+	 */
377
+	public function searchVehicles($searchParams)
378
+	{
379
+		$excludeFields = [];
380
+		$allBodyFields = Route4Me::getObjectProperties(new VehicleSearchParameters(), $excludeFields);
381
+
382
+		$response = Route4Me::makeRequst([
383
+			'url' => Endpoint::VehicleSearch,
384
+			'method' => 'POST',
385
+			'body' => Route4Me::generateRequestParameters($allBodyFields, $searchParams),
386
+			'HTTPHEADERS' => ['Content-Type: application/json', 'Accept: application/json']
387
+		]);
388
+
389
+		return $response;
390
+	}
391
+
392
+	/** Update the Vehicle Profile by specifying the path parameter ID and by sending.
393
+	 * @param  $vehicleParams - an array of vehicle's parameters or Vehicle object.
394
+	 * @return array          - an array of parameters of Vehicle
395
+	 * @throws \Route4Me\Exception\ApiError
396
+	 */
397
+	public function updateVehicle($vehicleParams)
398
+	{
399
+		$excludeFields = ['vehicle_id', 'is_deleted', 'created_time', 'timestamp_added', 'timestamp_removed'];
400
+		$allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields);
401
+
402
+		$response = Route4Me::makeRequst([
403
+			'url' => Endpoint::Vehicles.'/'.$vehicleParams['vehicle_id'],
404
+			'method' => 'PATCH',
405
+			'body' => Route4Me::generateRequestParameters($allBodyFields, $vehicleParams),
406
+			'HTTPHEADER' => 'Content-Type: application/json'
407
+		]);
408
+
409
+		return $response;
410
+	}
411 411
 }
Please login to merge, or discard this patch.
src/Route4Me/Vehicles/VehicleV4.php 2 patches
Indentation   +275 added lines, -275 removed lines patch added patch discarded remove patch
@@ -16,279 +16,279 @@
 block discarded – undo
16 16
  */
17 17
 class VehicleV4 extends \Route4Me\Common
18 18
 {
19
-    /** @var string $vehicle_id
20
-     * Vehicle unique 32-chars ID
21
-     */
22
-    public $vehicle_id;
23
-
24
-    /** @var int $member_id
25
-     * Member unique ID
26
-     */
27
-    public $member_id;
28
-
29
-    /** @var boolean $is_deleted
30
-     * True, if the vehicle was deleted.
31
-     */
32
-    public $is_deleted;
33
-
34
-    /** @var string $vehicle_alias
35
-     * Vehicle alias
36
-     */
37
-    public $vehicle_alias;
38
-
39
-    /** @var string $vehicle_vin
40
-     * Vehicle VIN (vehicle identification number)
41
-     */
42
-    public $vehicle_vin;
43
-
44
-    /** @var int $vehicle_reg_state_id
45
-     * The ID of a state the vehicle was registered.
46
-     */
47
-    public $vehicle_reg_state_id;
48
-
49
-    /** @var int $vehicle_reg_country_id
50
-     * The ID of a country the vehicle was registered.
51
-     */
52
-    public $vehicle_reg_country_id;
53
-
54
-    /** @var string $vehicle_license_plate
55
-     * A license plate of the vehicle.
56
-     */
57
-    public $vehicle_license_plate;
58
-
59
-    /** @var string $vehicle_type_id
60
-     * Vehicle type ID.
61
-     * Available values:
62
-     * 'sedan', 'suv', 'pickup_truck', 'van', '18wheeler', 'cabin', 'hatchback',
63
-     * 'motorcyle', 'waste_disposal', 'tree_cutting', 'bigrig', 'cement_mixer',
64
-     * 'livestock_carrier', 'dairy','tractor_trailer'
65
-     */
66
-    public $vehicle_type_id;
67
-
68
-    /** @var string $timestamp_added
69
-     * When the vehicle was added.
70
-     */
71
-    public $timestamp_added;
72
-
73
-    /** @var string $vehicle_make
74
-     * Vehicle maker brend.
75
-     * Available values:
76
-     * 'american coleman', 'bmw', 'chevrolet', 'ford', 'freightliner', 'gmc',
77
-     * 'hino', 'honda', 'isuzu', 'kenworth', 'mack', 'mercedes-benz', 'mitsubishi',
78
-     * 'navistar', 'nissan', 'peterbilt', 'renault', 'scania', 'sterling', 'toyota',
79
-     * 'volvo', 'western star'
80
-     */
81
-    public $vehicle_make;
82
-
83
-    /** @var int $vehicle_model_year
84
-     * A year of the vehicle model.
85
-     */
86
-    public $vehicle_model_year;
87
-
88
-    /** @var string $vehicle_model
89
-     * A model of the vehicle.
90
-     */
91
-    public $vehicle_model;
92
-
93
-    /** @var int $vehicle_year_acquired
94
-     * A year, the vehicle was acquired.
95
-     */
96
-    public $vehicle_year_acquired;
97
-
98
-    /** @var string $vehicle_cost_new
99
-     * A cost of the new vehicle.
100
-     */
101
-    public $vehicle_cost_new;
102
-
103
-    /** @var string $purchased_new
104
-     * If true, the vehicle was purchased new.
105
-     */
106
-    public $purchased_new;
107
-
108
-    /** @var string $license_start_date
109
-     * Start date of the license (e.g. '2020-12-20').
110
-     */
111
-    public $license_start_date;
112
-
113
-    /** @var string $license_end_date
114
-     * End date of the license (e.g. '2020-12-20').
115
-     */
116
-    public $license_end_date;
117
-
118
-    /** @var boolean $is_operational
119
-     * If true, the vehicle is operational.
120
-     */
121
-    public $is_operational;
122
-
123
-    /** @var string $fuel_type
124
-     * A type of the fuel.
125
-     * Available values:
126
-     * 'unleaded 87', 'unleaded 89', 'unleaded 91', 'unleaded 93', 'diesel', 'electric', 'hybrid'
127
-     */
128
-    public $fuel_type;
129
-
130
-    /** @var string $external_telematics_vehicle_id
131
-     * External telematics vehicle ID.
132
-     */
133
-    public $external_telematics_vehicle_id;
134
-
135
-    /** @var string $timestamp_removed
136
-     * When the vehicle was removed.
137
-     */
138
-    public $timestamp_removed;
139
-
140
-    /** @var string $vehicle_profile_id
141
-     * Vehicle profile ID
142
-     */
143
-    public $vehicle_profile_id;
144
-
145
-    /** @var double $fuel_consumption_city
146
-     * Fuel consumption in the city area.
147
-     */
148
-    public $fuel_consumption_city;
149
-
150
-    /** @var double $fuel_consumption_highway
151
-     * Fuel consumption in the highway area.
152
-     */
153
-    public $fuel_consumption_highway;
154
-
155
-    /** @var string $fuel_consumption_city_unit
156
-     * Fuel consumption unit in the city area (e.g. 'mi/l').
157
-     */
158
-    public $fuel_consumption_city_unit;
159
-
160
-    /** @var string $fuel_consumption_highway_unit
161
-     * Fuel consumption unit in the highway area (e.g. 'mi/l').
162
-     */
163
-    public $fuel_consumption_highway_unit;
164
-
165
-    /** @var double $mpg_city
166
-     * Miles per gallon in the city area.
167
-     */
168
-    public $mpg_city;
169
-
170
-    /** @var double $mpg_highway
171
-     * Miles per gallon in the highway area.
172
-     */
173
-    public $mpg_highway;
174
-
175
-    /** @var string $fuel_consumption_city_uf_value
176
-     * Fuel consumption UF (utility factor) value in the city area.
177
-     */
178
-    public $fuel_consumption_city_uf_value;
179
-
180
-    /** @var string $fuel_consumption_highway_uf_value
181
-     * Fuel consumption UF (utility factor) value in the highway area.
182
-     */
183
-    public $fuel_consumption_highway_uf_value;
184
-
185
-    public function __construct()
186
-    {
187
-        Route4Me::setBaseUrl(Endpoint::WH_BASE_URL);
188
-    }
189
-
190
-    public static function fromArray(array $params)
191
-    {
192
-        $vehicle = new self();
193
-
194
-        foreach ($params as $key => $value) {
195
-            if (is_null(Common::getValue($params, $key))) {
196
-                continue;
197
-            }
198
-            if (property_exists($vehicle, $key)) {
199
-                $vehicle->$key = $value;
200
-            }
201
-        }
202
-
203
-        return $vehicle;
204
-    }
205
-
206
-    /**
207
-     * @deprecated 1.2.6
208
-     * @see \Route4Me\V5\Vehicles\DataTypes\Vehicle::getVehiclesPaginatedList()
209
-     */
210
-    public static function getVehicles($params)
211
-    {
212
-        $allQueryFields = ['with_pagination', 'page', 'perPage'];
213
-
214
-        $response = Route4Me::makeRequst([
215
-            'url' => Endpoint::VEHICLE_V4,
216
-            'method' => 'GET',
217
-            'query' => Route4Me::generateRequestParameters($allQueryFields, $params),
218
-        ]);
219
-
220
-        return $response;
221
-    }
222
-
223
-    /**
224
-     * @deprecated 1.2.6
225
-     * @see \Route4Me\V5\Vehicles\DataTypes\Vehicle::getVehicleById()
226
-     */
227
-    public function getVehicleByID($vehicleID)
228
-    {
229
-        $response = Route4Me::makeRequst([
230
-            'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID,
231
-            'method' => 'GET',
232
-        ]);
233
-
234
-        return $response;
235
-    }
236
-
237
-    /**
238
-     * @deprecated 1.2.6
239
-     * @see \Route4Me\V5\Vehicles\DataTypes\Vehicle::updateVehicle()
240
-     */
241
-    public function updateVehicle($params)
242
-    {
243
-        $vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null;
244
-
245
-        $allBodyFields = Route4Me::getObjectProperties(new self(), ['vehicle_id']);
246
-
247
-        $response = Route4Me::makeRequst([
248
-            'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID,
249
-            'method' => 'PUT',
250
-            'body' => Route4Me::generateRequestParameters($allBodyFields, $params),
251
-            'HTTPHEADER' => 'Content-Type: application/json',
252
-        ]);
253
-
254
-        return $response;
255
-    }
256
-
257
-    /**
258
-     * @deprecated 1.2.6
259
-     * @see \Route4Me\V5\Vehicles\DataTypes\Vehicle::createVehicle()
260
-     */
261
-    public function createVehicle($params)
262
-    {
263
-        $excludeFields = ['vehicle_id','is_deleted','created_time','timestamp_added','timestamp_removed'];
264
-        $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields);
265
-
266
-        //Route4Me::setBaseUrl(Endpoint::BASE_URL);
267
-
268
-        $response = Route4Me::makeRequst([
269
-            'url' => Endpoint::VEHICLE_V4,
270
-            'method' => 'POST',
271
-            'body' => Route4Me::generateRequestParameters($allBodyFields, $params),
272
-            'HTTPHEADER' => 'Content-Type: application/json',
273
-        ]);
274
-
275
-        return $response;
276
-    }
277
-
278
-    /**
279
-     * @deprecated 1.2.6
280
-     * @see \Route4Me\V5\Vehicles\DataTypes\Vehicle::removeVehicle()
281
-     */
282
-    public function removeVehicle($params)
283
-    {
284
-        $vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null;
285
-
286
-        $response = Route4Me::makeRequst([
287
-            'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID,
288
-            'method' => 'DELETE',
289
-            'HTTPHEADER' => 'Content-Type: application/json',
290
-        ]);
291
-
292
-        return $response;
293
-    }
19
+	/** @var string $vehicle_id
20
+	 * Vehicle unique 32-chars ID
21
+	 */
22
+	public $vehicle_id;
23
+
24
+	/** @var int $member_id
25
+	 * Member unique ID
26
+	 */
27
+	public $member_id;
28
+
29
+	/** @var boolean $is_deleted
30
+	 * True, if the vehicle was deleted.
31
+	 */
32
+	public $is_deleted;
33
+
34
+	/** @var string $vehicle_alias
35
+	 * Vehicle alias
36
+	 */
37
+	public $vehicle_alias;
38
+
39
+	/** @var string $vehicle_vin
40
+	 * Vehicle VIN (vehicle identification number)
41
+	 */
42
+	public $vehicle_vin;
43
+
44
+	/** @var int $vehicle_reg_state_id
45
+	 * The ID of a state the vehicle was registered.
46
+	 */
47
+	public $vehicle_reg_state_id;
48
+
49
+	/** @var int $vehicle_reg_country_id
50
+	 * The ID of a country the vehicle was registered.
51
+	 */
52
+	public $vehicle_reg_country_id;
53
+
54
+	/** @var string $vehicle_license_plate
55
+	 * A license plate of the vehicle.
56
+	 */
57
+	public $vehicle_license_plate;
58
+
59
+	/** @var string $vehicle_type_id
60
+	 * Vehicle type ID.
61
+	 * Available values:
62
+	 * 'sedan', 'suv', 'pickup_truck', 'van', '18wheeler', 'cabin', 'hatchback',
63
+	 * 'motorcyle', 'waste_disposal', 'tree_cutting', 'bigrig', 'cement_mixer',
64
+	 * 'livestock_carrier', 'dairy','tractor_trailer'
65
+	 */
66
+	public $vehicle_type_id;
67
+
68
+	/** @var string $timestamp_added
69
+	 * When the vehicle was added.
70
+	 */
71
+	public $timestamp_added;
72
+
73
+	/** @var string $vehicle_make
74
+	 * Vehicle maker brend.
75
+	 * Available values:
76
+	 * 'american coleman', 'bmw', 'chevrolet', 'ford', 'freightliner', 'gmc',
77
+	 * 'hino', 'honda', 'isuzu', 'kenworth', 'mack', 'mercedes-benz', 'mitsubishi',
78
+	 * 'navistar', 'nissan', 'peterbilt', 'renault', 'scania', 'sterling', 'toyota',
79
+	 * 'volvo', 'western star'
80
+	 */
81
+	public $vehicle_make;
82
+
83
+	/** @var int $vehicle_model_year
84
+	 * A year of the vehicle model.
85
+	 */
86
+	public $vehicle_model_year;
87
+
88
+	/** @var string $vehicle_model
89
+	 * A model of the vehicle.
90
+	 */
91
+	public $vehicle_model;
92
+
93
+	/** @var int $vehicle_year_acquired
94
+	 * A year, the vehicle was acquired.
95
+	 */
96
+	public $vehicle_year_acquired;
97
+
98
+	/** @var string $vehicle_cost_new
99
+	 * A cost of the new vehicle.
100
+	 */
101
+	public $vehicle_cost_new;
102
+
103
+	/** @var string $purchased_new
104
+	 * If true, the vehicle was purchased new.
105
+	 */
106
+	public $purchased_new;
107
+
108
+	/** @var string $license_start_date
109
+	 * Start date of the license (e.g. '2020-12-20').
110
+	 */
111
+	public $license_start_date;
112
+
113
+	/** @var string $license_end_date
114
+	 * End date of the license (e.g. '2020-12-20').
115
+	 */
116
+	public $license_end_date;
117
+
118
+	/** @var boolean $is_operational
119
+	 * If true, the vehicle is operational.
120
+	 */
121
+	public $is_operational;
122
+
123
+	/** @var string $fuel_type
124
+	 * A type of the fuel.
125
+	 * Available values:
126
+	 * 'unleaded 87', 'unleaded 89', 'unleaded 91', 'unleaded 93', 'diesel', 'electric', 'hybrid'
127
+	 */
128
+	public $fuel_type;
129
+
130
+	/** @var string $external_telematics_vehicle_id
131
+	 * External telematics vehicle ID.
132
+	 */
133
+	public $external_telematics_vehicle_id;
134
+
135
+	/** @var string $timestamp_removed
136
+	 * When the vehicle was removed.
137
+	 */
138
+	public $timestamp_removed;
139
+
140
+	/** @var string $vehicle_profile_id
141
+	 * Vehicle profile ID
142
+	 */
143
+	public $vehicle_profile_id;
144
+
145
+	/** @var double $fuel_consumption_city
146
+	 * Fuel consumption in the city area.
147
+	 */
148
+	public $fuel_consumption_city;
149
+
150
+	/** @var double $fuel_consumption_highway
151
+	 * Fuel consumption in the highway area.
152
+	 */
153
+	public $fuel_consumption_highway;
154
+
155
+	/** @var string $fuel_consumption_city_unit
156
+	 * Fuel consumption unit in the city area (e.g. 'mi/l').
157
+	 */
158
+	public $fuel_consumption_city_unit;
159
+
160
+	/** @var string $fuel_consumption_highway_unit
161
+	 * Fuel consumption unit in the highway area (e.g. 'mi/l').
162
+	 */
163
+	public $fuel_consumption_highway_unit;
164
+
165
+	/** @var double $mpg_city
166
+	 * Miles per gallon in the city area.
167
+	 */
168
+	public $mpg_city;
169
+
170
+	/** @var double $mpg_highway
171
+	 * Miles per gallon in the highway area.
172
+	 */
173
+	public $mpg_highway;
174
+
175
+	/** @var string $fuel_consumption_city_uf_value
176
+	 * Fuel consumption UF (utility factor) value in the city area.
177
+	 */
178
+	public $fuel_consumption_city_uf_value;
179
+
180
+	/** @var string $fuel_consumption_highway_uf_value
181
+	 * Fuel consumption UF (utility factor) value in the highway area.
182
+	 */
183
+	public $fuel_consumption_highway_uf_value;
184
+
185
+	public function __construct()
186
+	{
187
+		Route4Me::setBaseUrl(Endpoint::WH_BASE_URL);
188
+	}
189
+
190
+	public static function fromArray(array $params)
191
+	{
192
+		$vehicle = new self();
193
+
194
+		foreach ($params as $key => $value) {
195
+			if (is_null(Common::getValue($params, $key))) {
196
+				continue;
197
+			}
198
+			if (property_exists($vehicle, $key)) {
199
+				$vehicle->$key = $value;
200
+			}
201
+		}
202
+
203
+		return $vehicle;
204
+	}
205
+
206
+	/**
207
+	 * @deprecated 1.2.6
208
+	 * @see \Route4Me\V5\Vehicles\DataTypes\Vehicle::getVehiclesPaginatedList()
209
+	 */
210
+	public static function getVehicles($params)
211
+	{
212
+		$allQueryFields = ['with_pagination', 'page', 'perPage'];
213
+
214
+		$response = Route4Me::makeRequst([
215
+			'url' => Endpoint::VEHICLE_V4,
216
+			'method' => 'GET',
217
+			'query' => Route4Me::generateRequestParameters($allQueryFields, $params),
218
+		]);
219
+
220
+		return $response;
221
+	}
222
+
223
+	/**
224
+	 * @deprecated 1.2.6
225
+	 * @see \Route4Me\V5\Vehicles\DataTypes\Vehicle::getVehicleById()
226
+	 */
227
+	public function getVehicleByID($vehicleID)
228
+	{
229
+		$response = Route4Me::makeRequst([
230
+			'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID,
231
+			'method' => 'GET',
232
+		]);
233
+
234
+		return $response;
235
+	}
236
+
237
+	/**
238
+	 * @deprecated 1.2.6
239
+	 * @see \Route4Me\V5\Vehicles\DataTypes\Vehicle::updateVehicle()
240
+	 */
241
+	public function updateVehicle($params)
242
+	{
243
+		$vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null;
244
+
245
+		$allBodyFields = Route4Me::getObjectProperties(new self(), ['vehicle_id']);
246
+
247
+		$response = Route4Me::makeRequst([
248
+			'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID,
249
+			'method' => 'PUT',
250
+			'body' => Route4Me::generateRequestParameters($allBodyFields, $params),
251
+			'HTTPHEADER' => 'Content-Type: application/json',
252
+		]);
253
+
254
+		return $response;
255
+	}
256
+
257
+	/**
258
+	 * @deprecated 1.2.6
259
+	 * @see \Route4Me\V5\Vehicles\DataTypes\Vehicle::createVehicle()
260
+	 */
261
+	public function createVehicle($params)
262
+	{
263
+		$excludeFields = ['vehicle_id','is_deleted','created_time','timestamp_added','timestamp_removed'];
264
+		$allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields);
265
+
266
+		//Route4Me::setBaseUrl(Endpoint::BASE_URL);
267
+
268
+		$response = Route4Me::makeRequst([
269
+			'url' => Endpoint::VEHICLE_V4,
270
+			'method' => 'POST',
271
+			'body' => Route4Me::generateRequestParameters($allBodyFields, $params),
272
+			'HTTPHEADER' => 'Content-Type: application/json',
273
+		]);
274
+
275
+		return $response;
276
+	}
277
+
278
+	/**
279
+	 * @deprecated 1.2.6
280
+	 * @see \Route4Me\V5\Vehicles\DataTypes\Vehicle::removeVehicle()
281
+	 */
282
+	public function removeVehicle($params)
283
+	{
284
+		$vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null;
285
+
286
+		$response = Route4Me::makeRequst([
287
+			'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID,
288
+			'method' => 'DELETE',
289
+			'HTTPHEADER' => 'Content-Type: application/json',
290
+		]);
291
+
292
+		return $response;
293
+	}
294 294
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -260,7 +260,7 @@
 block discarded – undo
260 260
      */
261 261
     public function createVehicle($params)
262 262
     {
263
-        $excludeFields = ['vehicle_id','is_deleted','created_time','timestamp_added','timestamp_removed'];
263
+        $excludeFields = ['vehicle_id', 'is_deleted', 'created_time', 'timestamp_added', 'timestamp_removed'];
264 264
         $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields);
265 265
 
266 266
         //Route4Me::setBaseUrl(Endpoint::BASE_URL);
Please login to merge, or discard this patch.
src/Route4Me/OptimizationProblem.php 2 patches
Indentation   +328 added lines, -328 removed lines patch added patch discarded remove patch
@@ -6,185 +6,185 @@  discard block
 block discarded – undo
6 6
 
7 7
 class OptimizationProblem extends Common
8 8
 {
9
-    /**
10
-     * Optimization problem ID
11
-     * @var string
12
-     */
13
-    public $optimization_problem_id;
14
-
15
-    /**
16
-     * Smart Optimization Problem ID
17
-     * @var string
18
-     */
19
-    public $smart_optimization_id;
20
-
21
-    /**
22
-     * An array of the user errors.
23
-     * @var string[]
24
-     */
25
-    public $user_errors = [];
26
-
27
-    /**
28
-     * An optimization problem state.<br>
29
-     * Available values:
30
-     * - OptimizationStateNew = 0,
31
-     * - Initial = 1,
32
-     * - MatrixProcessing = 2,
33
-     * - Optimizing = 3,
34
-     * - Optimized = 4,
35
-     * - Error = 5,
36
-     * - ComputingDirections = 6,
37
-     * - OptimizationStateInQueue = 7
38
-     * @var int
39
-     */
40
-    public $state;
41
-
42
-    /**
43
-     * An array of the optimization errors.
44
-     * @var string[]
45
-     */
46
-    public $optimization_errors = [];
47
-
48
-    /**
49
-     * Route Parameters.
50
-     * @var RouteParameters
51
-     */
52
-    public $parameters;
53
-
54
-    /**
55
-     * If true it means the solution was not returned (it is being computed in the background).
56
-     * @var boolean
57
-     */
58
-    public $sent_to_background;
59
-
60
-    /**
61
-     * When the optimization problem was created.
62
-     * @var long
63
-     */
64
-    public $created_timestamp;
65
-
66
-    /**
67
-     * An Unix Timestamp the Optimization Problem was scheduled for.
68
-     * @var long
69
-     */
70
-    public $scheduled_for;
71
-
72
-    /**
73
-     * When the optimization completed.
74
-     * @var long
75
-     */
76
-    public $optimization_completed_timestamp;
77
-
78
-    /**
79
-     * An array ot the Address type objects.
80
-     * @var Address[]
81
-     */
82
-    public $addresses = [];
83
-
84
-    /**
85
-     * An array ot the DataObjectRoute type objects.<br>
86
-     * The routes included in the optimization problem.
87
-     * @var Route[]
88
-     */
89
-    public $routes = [];
90
-
91
-    /** @var string[] $links
92
-     * The links to the GET operations for the optimization problem.
93
-     */
94
-    public $links = [];
95
-
96
-    public function __construct()
97
-    {
98
-        Route4Me::setBaseUrl(Endpoint::BASE_URL);
99
-        $this->parameters = new RouteParameters();
100
-    }
101
-
102
-    public static function fromArray(array $params)
103
-    {
104
-        $problem = new self();
105
-        $problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
106
-        $problem->user_errors = Common::getValue($params, 'user_errors', []);
107
-        $problem->state = Common::getValue($params, 'state', []);
108
-        $problem->sent_to_background = Common::getValue($params, 'sent_to_background', []);
109
-        $problem->links = Common::getValue($params, 'links', []);
110
-
111
-        if (isset($params['parameters'])) {
112
-            $problem->parameters = RouteParameters::fromArray($params['parameters']);
113
-        }
114
-
115
-        if (isset($params['addresses'])) {
116
-            $addresses = [];
117
-
118
-            foreach ($params['addresses'] as $address) {
119
-                $addresses[] = Address::fromArray($address);
120
-            }
121
-
122
-            $problem->addresses = $addresses;
123
-        }
124
-
125
-        if (isset($params['routes'])) {
126
-            $routes = [];
127
-
128
-            foreach ($params['routes'] as $route) {
129
-                $routes[] = Route::fromArray($route);
130
-            }
131
-
132
-            $problem->routes = $routes;
133
-        }
134
-
135
-        return $problem;
136
-    }
137
-
138
-    public static function optimize(OptimizationProblemParams $params)
139
-    {
140
-        $allQueryFields = ['redirect', 'directions', 'format', 'route_path_output', 'optimized_callback_url'];
141
-
142
-        $optimize = Route4Me::makeRequst([
143
-            'url'       => Endpoint::OPTIMIZATION_PROBLEM,
144
-            'method'    => 'POST',
145
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
146
-            'body'      => [
147
-                'addresses'     => $params->getAddressesArray(),
148
-                'depots'        => $params->getDepotsArray(),
149
-                'parameters'    => $params->getParametersArray(),
150
-            ],
151
-        ]);
152
-
153
-        return self::fromArray($optimize);
154
-    }
155
-
156
-    public static function get($params)
157
-    {
158
-        $allQueryFields = ['state', 'limit', 'format', 'offset',
159
-        'optimization_problem_id', 'wait_for_final_state','start_date','end_date', ];
160
-
161
-        $result = Route4Me::makeRequst([
162
-            'url'       => Endpoint::OPTIMIZATION_PROBLEM,
163
-            'method'    => 'GET',
164
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
165
-        ]);
166
-
167
-        if (isset($result['optimizations'])) {
168
-            $problems = [];
169
-
170
-            foreach ($result['optimizations'] as $problem) {
171
-                $problems[] = self::fromArray($problem);
172
-            }
173
-
174
-            return $problems;
175
-        } else {
176
-            return self::fromArray($result);
177
-        }
178
-    }
179
-
180
-    public function reoptimize($params)
181
-    {
182
-        $param['reoptimize'] = 1;
183
-
184
-        return self::update($params);
185
-    }
186
-
187
-    /*
9
+	/**
10
+	 * Optimization problem ID
11
+	 * @var string
12
+	 */
13
+	public $optimization_problem_id;
14
+
15
+	/**
16
+	 * Smart Optimization Problem ID
17
+	 * @var string
18
+	 */
19
+	public $smart_optimization_id;
20
+
21
+	/**
22
+	 * An array of the user errors.
23
+	 * @var string[]
24
+	 */
25
+	public $user_errors = [];
26
+
27
+	/**
28
+	 * An optimization problem state.<br>
29
+	 * Available values:
30
+	 * - OptimizationStateNew = 0,
31
+	 * - Initial = 1,
32
+	 * - MatrixProcessing = 2,
33
+	 * - Optimizing = 3,
34
+	 * - Optimized = 4,
35
+	 * - Error = 5,
36
+	 * - ComputingDirections = 6,
37
+	 * - OptimizationStateInQueue = 7
38
+	 * @var int
39
+	 */
40
+	public $state;
41
+
42
+	/**
43
+	 * An array of the optimization errors.
44
+	 * @var string[]
45
+	 */
46
+	public $optimization_errors = [];
47
+
48
+	/**
49
+	 * Route Parameters.
50
+	 * @var RouteParameters
51
+	 */
52
+	public $parameters;
53
+
54
+	/**
55
+	 * If true it means the solution was not returned (it is being computed in the background).
56
+	 * @var boolean
57
+	 */
58
+	public $sent_to_background;
59
+
60
+	/**
61
+	 * When the optimization problem was created.
62
+	 * @var long
63
+	 */
64
+	public $created_timestamp;
65
+
66
+	/**
67
+	 * An Unix Timestamp the Optimization Problem was scheduled for.
68
+	 * @var long
69
+	 */
70
+	public $scheduled_for;
71
+
72
+	/**
73
+	 * When the optimization completed.
74
+	 * @var long
75
+	 */
76
+	public $optimization_completed_timestamp;
77
+
78
+	/**
79
+	 * An array ot the Address type objects.
80
+	 * @var Address[]
81
+	 */
82
+	public $addresses = [];
83
+
84
+	/**
85
+	 * An array ot the DataObjectRoute type objects.<br>
86
+	 * The routes included in the optimization problem.
87
+	 * @var Route[]
88
+	 */
89
+	public $routes = [];
90
+
91
+	/** @var string[] $links
92
+	 * The links to the GET operations for the optimization problem.
93
+	 */
94
+	public $links = [];
95
+
96
+	public function __construct()
97
+	{
98
+		Route4Me::setBaseUrl(Endpoint::BASE_URL);
99
+		$this->parameters = new RouteParameters();
100
+	}
101
+
102
+	public static function fromArray(array $params)
103
+	{
104
+		$problem = new self();
105
+		$problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
106
+		$problem->user_errors = Common::getValue($params, 'user_errors', []);
107
+		$problem->state = Common::getValue($params, 'state', []);
108
+		$problem->sent_to_background = Common::getValue($params, 'sent_to_background', []);
109
+		$problem->links = Common::getValue($params, 'links', []);
110
+
111
+		if (isset($params['parameters'])) {
112
+			$problem->parameters = RouteParameters::fromArray($params['parameters']);
113
+		}
114
+
115
+		if (isset($params['addresses'])) {
116
+			$addresses = [];
117
+
118
+			foreach ($params['addresses'] as $address) {
119
+				$addresses[] = Address::fromArray($address);
120
+			}
121
+
122
+			$problem->addresses = $addresses;
123
+		}
124
+
125
+		if (isset($params['routes'])) {
126
+			$routes = [];
127
+
128
+			foreach ($params['routes'] as $route) {
129
+				$routes[] = Route::fromArray($route);
130
+			}
131
+
132
+			$problem->routes = $routes;
133
+		}
134
+
135
+		return $problem;
136
+	}
137
+
138
+	public static function optimize(OptimizationProblemParams $params)
139
+	{
140
+		$allQueryFields = ['redirect', 'directions', 'format', 'route_path_output', 'optimized_callback_url'];
141
+
142
+		$optimize = Route4Me::makeRequst([
143
+			'url'       => Endpoint::OPTIMIZATION_PROBLEM,
144
+			'method'    => 'POST',
145
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
146
+			'body'      => [
147
+				'addresses'     => $params->getAddressesArray(),
148
+				'depots'        => $params->getDepotsArray(),
149
+				'parameters'    => $params->getParametersArray(),
150
+			],
151
+		]);
152
+
153
+		return self::fromArray($optimize);
154
+	}
155
+
156
+	public static function get($params)
157
+	{
158
+		$allQueryFields = ['state', 'limit', 'format', 'offset',
159
+		'optimization_problem_id', 'wait_for_final_state','start_date','end_date', ];
160
+
161
+		$result = Route4Me::makeRequst([
162
+			'url'       => Endpoint::OPTIMIZATION_PROBLEM,
163
+			'method'    => 'GET',
164
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
165
+		]);
166
+
167
+		if (isset($result['optimizations'])) {
168
+			$problems = [];
169
+
170
+			foreach ($result['optimizations'] as $problem) {
171
+				$problems[] = self::fromArray($problem);
172
+			}
173
+
174
+			return $problems;
175
+		} else {
176
+			return self::fromArray($result);
177
+		}
178
+	}
179
+
180
+	public function reoptimize($params)
181
+	{
182
+		$param['reoptimize'] = 1;
183
+
184
+		return self::update($params);
185
+	}
186
+
187
+	/*
188 188
      * Updates an existing optimization problem.<br>
189 189
      * @param array $params with items:
190 190
      * - optimization_problem_id   : query parameter. ID of an updated optimization;
@@ -193,157 +193,157 @@  discard block
 block discarded – undo
193 193
      * - parameters                : body parameter. Modified route parameters;
194 194
      * @return Optimization problem
195 195
      */
196
-    public static function update($params)
197
-    {
198
-        $allQueryFields = ['optimization_problem_id', 'reoptimize'];
199
-        $allBodyFields = ['addresses', 'parameters'];
200
-        $query = null;
201
-        $body = null;
202
-
203
-        if (is_array($params)) {
204
-            if (isset($params['optimization_problem_id']) || isset($params['parameters'])) {
205
-                $query = Route4Me::generateRequestParameters($allQueryFields, $params);
206
-            }
207
-
208
-            if ((isset($params['addresses']) && sizeof($params['addresses']) > 0)
209
-                || (isset($params['parameters']) && sizeof($params['parameters']) > 0)
210
-            ) {
211
-                $body = Route4Me::generateRequestParameters($allBodyFields, $params);
212
-            }
213
-        } else {
214
-            if (isset($params->optimization_problem_id) || isset($params->parameters)) {
215
-                $query = Route4Me::generateRequestParameters($allQueryFields, $params);
216
-            }
217
-
218
-            if ((isset($params->addresses) && sizeof($params->addresses) > 0)
219
-                || (isset($params->parameters) && sizeof($params->parameters) > 0)
220
-            ) {
221
-                $body = Route4Me::generateRequestParameters($allBodyFields, $params);
222
-            }
223
-        }
224
-
225
-        $optimize = Route4Me::makeRequst([
226
-            'url'       => Endpoint::OPTIMIZATION_PROBLEM,
227
-            'method'    => 'PUT',
228
-            'query'     => $query,
229
-            'body'      => $body,
230
-        ]);
231
-
232
-        return $optimize;
233
-    }
234
-
235
-    public function getOptimizationId()
236
-    {
237
-        return $this->optimization_problem_id;
238
-    }
239
-
240
-    public function getRoutes()
241
-    {
242
-        return $this->routes;
243
-    }
244
-
245
-    public function getRandomOptimizationId($offset, $limit)
246
-    {
247
-        $optimizations = self::get(['offset' => $offset, 'limit' => $limit]);
248
-
249
-        $rOptimization = $optimizations[rand(0, sizeof($optimizations) - 1)];
250
-
251
-        if (!isset($rOptimization->optimization_problem_id)) {
252
-            if (sizeof($optimizations) > 9) {
253
-                $this->getRandomOptimizationId($offset, $limit);
254
-            } else {
255
-                return null;
256
-            }
257
-        }
258
-
259
-        return $rOptimization->optimization_problem_id;
260
-    }
261
-
262
-    public function getAddresses($opt_id)
263
-    {
264
-        if (null == $opt_id) {
265
-            return null;
266
-        }
267
-
268
-        $params = ['optimization_problem_id' => $opt_id];
269
-
270
-        $optimization = (array) $this->get($params);
271
-
272
-        $addresses = $optimization['addresses'];
273
-
274
-        return $addresses;
275
-    }
276
-
277
-    public function getRandomAddressFromOptimization($opt_id)
278
-    {
279
-        $addresses = (array) $this->getAddresses($opt_id);
280
-
281
-        if (null == $addresses) {
282
-            echo 'There are no addresses in this optimization!.. Try again.';
283
-
284
-            return null;
285
-        }
286
-
287
-        $num = rand(0, sizeof($addresses) - 1);
288
-
289
-        $rAddress = $addresses[$num];
290
-
291
-        return $rAddress;
292
-    }
293
-
294
-    public function removeAddress($params)
295
-    {
296
-        $allQueryFields = ['optimization_problem_id', 'route_destination_id'];
297
-
298
-        $response = Route4Me::makeRequst([
299
-            'url'       => Endpoint::ADDRESS_V4,
300
-            'method'    => 'DELETE',
301
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
302
-        ]);
303
-
304
-        return $response;
305
-    }
306
-
307
-    public function removeOptimization($params)
308
-    {
309
-        $allQueryFields = ['redirect'];
310
-        $allBodyFields = ['optimization_problem_ids'];
311
-
312
-        $response = Route4Me::makeRequst([
313
-            'url'       => Endpoint::OPTIMIZATION_PROBLEM,
314
-            'method'    => 'DELETE',
315
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
316
-            'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
317
-        ]);
318
-
319
-        return $response;
320
-    }
321
-
322
-    public function getHybridOptimization($params)
323
-    {
324
-        $allQueryFields = ['target_date_string', 'timezone_offset_minutes'];
325
-
326
-        $optimize = Route4Me::makeRequst([
327
-            'url'       => Endpoint::HYBRID_DATE_OPTIMIZATION,
328
-            'method'    => 'GET',
329
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
330
-        ]);
196
+	public static function update($params)
197
+	{
198
+		$allQueryFields = ['optimization_problem_id', 'reoptimize'];
199
+		$allBodyFields = ['addresses', 'parameters'];
200
+		$query = null;
201
+		$body = null;
202
+
203
+		if (is_array($params)) {
204
+			if (isset($params['optimization_problem_id']) || isset($params['parameters'])) {
205
+				$query = Route4Me::generateRequestParameters($allQueryFields, $params);
206
+			}
207
+
208
+			if ((isset($params['addresses']) && sizeof($params['addresses']) > 0)
209
+				|| (isset($params['parameters']) && sizeof($params['parameters']) > 0)
210
+			) {
211
+				$body = Route4Me::generateRequestParameters($allBodyFields, $params);
212
+			}
213
+		} else {
214
+			if (isset($params->optimization_problem_id) || isset($params->parameters)) {
215
+				$query = Route4Me::generateRequestParameters($allQueryFields, $params);
216
+			}
217
+
218
+			if ((isset($params->addresses) && sizeof($params->addresses) > 0)
219
+				|| (isset($params->parameters) && sizeof($params->parameters) > 0)
220
+			) {
221
+				$body = Route4Me::generateRequestParameters($allBodyFields, $params);
222
+			}
223
+		}
224
+
225
+		$optimize = Route4Me::makeRequst([
226
+			'url'       => Endpoint::OPTIMIZATION_PROBLEM,
227
+			'method'    => 'PUT',
228
+			'query'     => $query,
229
+			'body'      => $body,
230
+		]);
231
+
232
+		return $optimize;
233
+	}
234
+
235
+	public function getOptimizationId()
236
+	{
237
+		return $this->optimization_problem_id;
238
+	}
239
+
240
+	public function getRoutes()
241
+	{
242
+		return $this->routes;
243
+	}
244
+
245
+	public function getRandomOptimizationId($offset, $limit)
246
+	{
247
+		$optimizations = self::get(['offset' => $offset, 'limit' => $limit]);
248
+
249
+		$rOptimization = $optimizations[rand(0, sizeof($optimizations) - 1)];
250
+
251
+		if (!isset($rOptimization->optimization_problem_id)) {
252
+			if (sizeof($optimizations) > 9) {
253
+				$this->getRandomOptimizationId($offset, $limit);
254
+			} else {
255
+				return null;
256
+			}
257
+		}
258
+
259
+		return $rOptimization->optimization_problem_id;
260
+	}
261
+
262
+	public function getAddresses($opt_id)
263
+	{
264
+		if (null == $opt_id) {
265
+			return null;
266
+		}
267
+
268
+		$params = ['optimization_problem_id' => $opt_id];
269
+
270
+		$optimization = (array) $this->get($params);
271
+
272
+		$addresses = $optimization['addresses'];
273
+
274
+		return $addresses;
275
+	}
276
+
277
+	public function getRandomAddressFromOptimization($opt_id)
278
+	{
279
+		$addresses = (array) $this->getAddresses($opt_id);
280
+
281
+		if (null == $addresses) {
282
+			echo 'There are no addresses in this optimization!.. Try again.';
283
+
284
+			return null;
285
+		}
286
+
287
+		$num = rand(0, sizeof($addresses) - 1);
288
+
289
+		$rAddress = $addresses[$num];
290
+
291
+		return $rAddress;
292
+	}
293
+
294
+	public function removeAddress($params)
295
+	{
296
+		$allQueryFields = ['optimization_problem_id', 'route_destination_id'];
297
+
298
+		$response = Route4Me::makeRequst([
299
+			'url'       => Endpoint::ADDRESS_V4,
300
+			'method'    => 'DELETE',
301
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
302
+		]);
303
+
304
+		return $response;
305
+	}
306
+
307
+	public function removeOptimization($params)
308
+	{
309
+		$allQueryFields = ['redirect'];
310
+		$allBodyFields = ['optimization_problem_ids'];
311
+
312
+		$response = Route4Me::makeRequst([
313
+			'url'       => Endpoint::OPTIMIZATION_PROBLEM,
314
+			'method'    => 'DELETE',
315
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
316
+			'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
317
+		]);
318
+
319
+		return $response;
320
+	}
321
+
322
+	public function getHybridOptimization($params)
323
+	{
324
+		$allQueryFields = ['target_date_string', 'timezone_offset_minutes'];
325
+
326
+		$optimize = Route4Me::makeRequst([
327
+			'url'       => Endpoint::HYBRID_DATE_OPTIMIZATION,
328
+			'method'    => 'GET',
329
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
330
+		]);
331 331
 
332
-        return $optimize;
333
-    }
332
+		return $optimize;
333
+	}
334 334
 
335
-    public function addDepotsToHybrid($params)
336
-    {
337
-        $allQueryFields = ['optimization_problem_id'];
338
-        $allBodyFields = ['optimization_problem_id', 'delete_old_depots', 'new_depots'];
335
+	public function addDepotsToHybrid($params)
336
+	{
337
+		$allQueryFields = ['optimization_problem_id'];
338
+		$allBodyFields = ['optimization_problem_id', 'delete_old_depots', 'new_depots'];
339 339
 
340
-        $depots = Route4Me::makeRequst([
341
-            'url'       => Endpoint::CHANGE_HYBRID_OPTIMIZATION_DEPOT,
342
-            'method'    => 'POST',
343
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
344
-            'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
345
-        ]);
340
+		$depots = Route4Me::makeRequst([
341
+			'url'       => Endpoint::CHANGE_HYBRID_OPTIMIZATION_DEPOT,
342
+			'method'    => 'POST',
343
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
344
+			'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
345
+		]);
346 346
 
347
-        return $depots;
348
-    }
347
+		return $depots;
348
+	}
349 349
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     public static function get($params)
157 157
     {
158 158
         $allQueryFields = ['state', 'limit', 'format', 'offset',
159
-        'optimization_problem_id', 'wait_for_final_state','start_date','end_date', ];
159
+        'optimization_problem_id', 'wait_for_final_state', 'start_date', 'end_date', ];
160 160
 
161 161
         $result = Route4Me::makeRequst([
162 162
             'url'       => Endpoint::OPTIMIZATION_PROBLEM,
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
                 $query = Route4Me::generateRequestParameters($allQueryFields, $params);
206 206
             }
207 207
 
208
-            if ((isset($params['addresses']) && sizeof($params['addresses']) > 0)
209
-                || (isset($params['parameters']) && sizeof($params['parameters']) > 0)
208
+            if ((isset($params['addresses']) && sizeof($params['addresses'])>0)
209
+                || (isset($params['parameters']) && sizeof($params['parameters'])>0)
210 210
             ) {
211 211
                 $body = Route4Me::generateRequestParameters($allBodyFields, $params);
212 212
             }
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
                 $query = Route4Me::generateRequestParameters($allQueryFields, $params);
216 216
             }
217 217
 
218
-            if ((isset($params->addresses) && sizeof($params->addresses) > 0)
219
-                || (isset($params->parameters) && sizeof($params->parameters) > 0)
218
+            if ((isset($params->addresses) && sizeof($params->addresses)>0)
219
+                || (isset($params->parameters) && sizeof($params->parameters)>0)
220 220
             ) {
221 221
                 $body = Route4Me::generateRequestParameters($allBodyFields, $params);
222 222
             }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
         $rOptimization = $optimizations[rand(0, sizeof($optimizations) - 1)];
250 250
 
251 251
         if (!isset($rOptimization->optimization_problem_id)) {
252
-            if (sizeof($optimizations) > 9) {
252
+            if (sizeof($optimizations)>9) {
253 253
                 $this->getRandomOptimizationId($offset, $limit);
254 254
             } else {
255 255
                 return null;
@@ -261,13 +261,13 @@  discard block
 block discarded – undo
261 261
 
262 262
     public function getAddresses($opt_id)
263 263
     {
264
-        if (null == $opt_id) {
264
+        if (null==$opt_id) {
265 265
             return null;
266 266
         }
267 267
 
268 268
         $params = ['optimization_problem_id' => $opt_id];
269 269
 
270
-        $optimization = (array) $this->get($params);
270
+        $optimization = (array)$this->get($params);
271 271
 
272 272
         $addresses = $optimization['addresses'];
273 273
 
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 
277 277
     public function getRandomAddressFromOptimization($opt_id)
278 278
     {
279
-        $addresses = (array) $this->getAddresses($opt_id);
279
+        $addresses = (array)$this->getAddresses($opt_id);
280 280
 
281
-        if (null == $addresses) {
281
+        if (null==$addresses) {
282 282
             echo 'There are no addresses in this optimization!.. Try again.';
283 283
 
284 284
             return null;
Please login to merge, or discard this patch.
UnitTestFiles/Test/V5/TeamManagementUnitTests.php 2 patches
Indentation   +177 added lines, -177 removed lines patch added patch discarded remove patch
@@ -12,184 +12,184 @@
 block discarded – undo
12 12
 
13 13
 final class TeamManagementUnitTests extends \PHPUnit\Framework\TestCase
14 14
 {
15
-    public static ?int $member_id = null;
16
-    public static ?int $owner_member_id = null;
17
-
18
-    public static function setUpBeforeClass() : void
19
-    {
20
-        Route4Me::setApiKey(Constants::API_KEY);
21
-    }
22
-
23
-    public function testOwnerMemberMustExists() : void
24
-    {
25
-        $member = new Member();
26
-        $res_members = $member->getUsers();
15
+	public static ?int $member_id = null;
16
+	public static ?int $owner_member_id = null;
17
+
18
+	public static function setUpBeforeClass() : void
19
+	{
20
+		Route4Me::setApiKey(Constants::API_KEY);
21
+	}
22
+
23
+	public function testOwnerMemberMustExists() : void
24
+	{
25
+		$member = new Member();
26
+		$res_members = $member->getUsers();
27 27
     
28
-        if (is_array($res_members) && isset($res_members['results'])) {
29
-            foreach ($res_members['results'] as $key => $value) {
30
-                if ($value['OWNER_MEMBER_ID'] == 0) {
31
-                    self::$owner_member_id = $value['member_id'];
32
-                    break;
33
-                }
34
-            }
35
-        }
36
-        $this->assertNotNull(self::$owner_member_id);
37
-    }
38
-
39
-    public function testOptionCanBeCreateEmpty() : void
40
-    {
41
-        $this->assertInstanceOf(Option::class, new Option());
42
-    }
43
-
44
-    public function testOptionCanBeCreateFromArray() : void
45
-    {
46
-        $this->assertInstanceOf(Option::class, new Option([
47
-            'value' => '1',
48
-            'title' => '2'
49
-        ]));
50
-    }
51
-
52
-    public function testPermissionCanBeCreateEmpty() : void
53
-    {
54
-        $this->assertInstanceOf(Permission::class, new Permission());
55
-    }
56
-
57
-    public function testPermissionCanBeCreateFromArray() : void
58
-    {
59
-        $this->assertInstanceOf(Permission::class, new Permission([
60
-            'id' => '1',
61
-            'options' => [
62
-                [
63
-                    'value' => '2',
64
-                    'title' => '3'
65
-                ], [
66
-                    'value' => '4',
67
-                    'title' => '5'
68
-                ]
69
-            ]
70
-        ]));
71
-    }
72
-
73
-    public function testResponseTeamCanBeCreateEmpty() : void
74
-    {
75
-        $this->assertInstanceOf(ResponseTeam::class, new ResponseTeam());
76
-    }
77
-
78
-    public function testResponseTeamCanBeCreateFromArray() : void
79
-    {
80
-        $this->assertInstanceOf(ResponseTeam::class, new ResponseTeam([
81
-            'member_id' => '1',
82
-            'member_first_name' => '2'
83
-        ]));
84
-    }
85
-
86
-    public function testTeamManagementCanBeCreateEmpty() : void
87
-    {
88
-        $this->assertInstanceOf(TeamManagement::class, new TeamManagement());
89
-    }
90
-
91
-    public function testCreateMustReturnResponseTeam() : void
92
-    {
93
-        $team_mng = new TeamManagement();
94
-        $res_team = $team_mng->create([
95
-            'new_password' => '12345&Qwerty',
96
-            'member_first_name' => 'Tusha I',
97
-            'member_last_name' => 'Pupkindzes',
98
-            'member_email' => '[email protected]',
99
-            'member_type' => 'SUB_ACCOUNT_DRIVER',
100
-            'OWNER_MEMBER_ID' => self::$owner_member_id
101
-        ]);
102
-
103
-        $this->assertInstanceOf(ResponseTeam::class, $res_team);
104
-        $this->assertNotNull($res_team->member_id);
105
-        $this->assertEquals($res_team->member_first_name, 'Tusha I');
28
+		if (is_array($res_members) && isset($res_members['results'])) {
29
+			foreach ($res_members['results'] as $key => $value) {
30
+				if ($value['OWNER_MEMBER_ID'] == 0) {
31
+					self::$owner_member_id = $value['member_id'];
32
+					break;
33
+				}
34
+			}
35
+		}
36
+		$this->assertNotNull(self::$owner_member_id);
37
+	}
38
+
39
+	public function testOptionCanBeCreateEmpty() : void
40
+	{
41
+		$this->assertInstanceOf(Option::class, new Option());
42
+	}
43
+
44
+	public function testOptionCanBeCreateFromArray() : void
45
+	{
46
+		$this->assertInstanceOf(Option::class, new Option([
47
+			'value' => '1',
48
+			'title' => '2'
49
+		]));
50
+	}
51
+
52
+	public function testPermissionCanBeCreateEmpty() : void
53
+	{
54
+		$this->assertInstanceOf(Permission::class, new Permission());
55
+	}
56
+
57
+	public function testPermissionCanBeCreateFromArray() : void
58
+	{
59
+		$this->assertInstanceOf(Permission::class, new Permission([
60
+			'id' => '1',
61
+			'options' => [
62
+				[
63
+					'value' => '2',
64
+					'title' => '3'
65
+				], [
66
+					'value' => '4',
67
+					'title' => '5'
68
+				]
69
+			]
70
+		]));
71
+	}
72
+
73
+	public function testResponseTeamCanBeCreateEmpty() : void
74
+	{
75
+		$this->assertInstanceOf(ResponseTeam::class, new ResponseTeam());
76
+	}
77
+
78
+	public function testResponseTeamCanBeCreateFromArray() : void
79
+	{
80
+		$this->assertInstanceOf(ResponseTeam::class, new ResponseTeam([
81
+			'member_id' => '1',
82
+			'member_first_name' => '2'
83
+		]));
84
+	}
85
+
86
+	public function testTeamManagementCanBeCreateEmpty() : void
87
+	{
88
+		$this->assertInstanceOf(TeamManagement::class, new TeamManagement());
89
+	}
90
+
91
+	public function testCreateMustReturnResponseTeam() : void
92
+	{
93
+		$team_mng = new TeamManagement();
94
+		$res_team = $team_mng->create([
95
+			'new_password' => '12345&Qwerty',
96
+			'member_first_name' => 'Tusha I',
97
+			'member_last_name' => 'Pupkindzes',
98
+			'member_email' => '[email protected]',
99
+			'member_type' => 'SUB_ACCOUNT_DRIVER',
100
+			'OWNER_MEMBER_ID' => self::$owner_member_id
101
+		]);
102
+
103
+		$this->assertInstanceOf(ResponseTeam::class, $res_team);
104
+		$this->assertNotNull($res_team->member_id);
105
+		$this->assertEquals($res_team->member_first_name, 'Tusha I');
106 106
         
107
-        self::$member_id = $res_team->member_id;
108
-    }
109
-
110
-    public function testGetUserMustReturnResponseTeam() : void
111
-    {
112
-        $team_mng = new TeamManagement();
113
-        $res_team = $team_mng->getUser(self::$member_id);
114
-
115
-        $this->assertInstanceOf(ResponseTeam::class, $res_team);
116
-        $this->assertNotNull($res_team->member_id);
117
-        $this->assertEquals($res_team->member_first_name, 'Tusha I');
118
-    }
119
-
120
-    public function testGetUsersMustReturnArrayOfResponseTeam() : void
121
-    {
122
-        $team_mng = new TeamManagement();
123
-        $result = $team_mng->getUsers();
124
-
125
-        $this->assertIsArray($result);
126
-        if (count($result) > 0) {
127
-            $this->assertInstanceOf(ResponseTeam::class, $result[0]);
128
-        }
129
-    }
130
-
131
-    public function testUpdateMustReturnUpdatedResponseTeam() : void
132
-    {
133
-        $team_mng = new TeamManagement();
134
-        $res_team = $team_mng->update(self::$member_id, [
135
-            'HIDE_ROUTED_ADDRESSES' => true,
136
-            'member_type' => 'SUB_ACCOUNT_DISPATCHER'
137
-        ]);
138
-
139
-        $this->assertInstanceOf(ResponseTeam::class, $res_team);
140
-        $this->assertEquals($res_team->HIDE_ROUTED_ADDRESSES, 1);
141
-        $this->assertEquals($res_team->member_type, 'SUB_ACCOUNT_DISPATCHER');
142
-    }
143
-
144
-    public function testDeleteMustReturnDeletedResponseTeam() : void
145
-    {
146
-        $team_mng = new TeamManagement();
147
-        $res_team = $team_mng->delete(self::$member_id);
148
-
149
-        $this->assertInstanceOf(ResponseTeam::class, $res_team);
150
-        $this->assertNotNull($res_team->member_id);
151
-        $this->assertEquals($res_team->member_first_name, 'Tusha I');
152
-    }
153
-
154
-    public function testBulkInsertMustAddNewMembers() : void
155
-    {
156
-        $team_mng = new TeamManagement();
157
-        $result = $team_mng->bulkInsert([
158
-            [
159
-                'new_password' => '12345&Qwerty',
160
-                'member_first_name' => 'Tusha I',
161
-                'member_last_name' => 'Pupkindzes',
162
-                'member_email' => '[email protected]',
163
-                'member_type' => 'SUB_ACCOUNT_DRIVER',
164
-                'OWNER_MEMBER_ID' => self::$owner_member_id
165
-            ], [
166
-                'new_password' => '12345&Qwerty',
167
-                'member_first_name' => 'Tusha II',
168
-                'member_last_name' => 'Pupkindzes',
169
-                'member_email' => '[email protected]',
170
-                'member_type' => 'SUB_ACCOUNT_DRIVER',
171
-                'OWNER_MEMBER_ID' => self::$owner_member_id
172
-                ]
173
-        ], [
174
-            'conflicts' => 'overwrite'
175
-        ]);
176
-
177
-        $this->assertIsArray($result);
178
-    }
107
+		self::$member_id = $res_team->member_id;
108
+	}
109
+
110
+	public function testGetUserMustReturnResponseTeam() : void
111
+	{
112
+		$team_mng = new TeamManagement();
113
+		$res_team = $team_mng->getUser(self::$member_id);
114
+
115
+		$this->assertInstanceOf(ResponseTeam::class, $res_team);
116
+		$this->assertNotNull($res_team->member_id);
117
+		$this->assertEquals($res_team->member_first_name, 'Tusha I');
118
+	}
119
+
120
+	public function testGetUsersMustReturnArrayOfResponseTeam() : void
121
+	{
122
+		$team_mng = new TeamManagement();
123
+		$result = $team_mng->getUsers();
124
+
125
+		$this->assertIsArray($result);
126
+		if (count($result) > 0) {
127
+			$this->assertInstanceOf(ResponseTeam::class, $result[0]);
128
+		}
129
+	}
130
+
131
+	public function testUpdateMustReturnUpdatedResponseTeam() : void
132
+	{
133
+		$team_mng = new TeamManagement();
134
+		$res_team = $team_mng->update(self::$member_id, [
135
+			'HIDE_ROUTED_ADDRESSES' => true,
136
+			'member_type' => 'SUB_ACCOUNT_DISPATCHER'
137
+		]);
138
+
139
+		$this->assertInstanceOf(ResponseTeam::class, $res_team);
140
+		$this->assertEquals($res_team->HIDE_ROUTED_ADDRESSES, 1);
141
+		$this->assertEquals($res_team->member_type, 'SUB_ACCOUNT_DISPATCHER');
142
+	}
143
+
144
+	public function testDeleteMustReturnDeletedResponseTeam() : void
145
+	{
146
+		$team_mng = new TeamManagement();
147
+		$res_team = $team_mng->delete(self::$member_id);
148
+
149
+		$this->assertInstanceOf(ResponseTeam::class, $res_team);
150
+		$this->assertNotNull($res_team->member_id);
151
+		$this->assertEquals($res_team->member_first_name, 'Tusha I');
152
+	}
153
+
154
+	public function testBulkInsertMustAddNewMembers() : void
155
+	{
156
+		$team_mng = new TeamManagement();
157
+		$result = $team_mng->bulkInsert([
158
+			[
159
+				'new_password' => '12345&Qwerty',
160
+				'member_first_name' => 'Tusha I',
161
+				'member_last_name' => 'Pupkindzes',
162
+				'member_email' => '[email protected]',
163
+				'member_type' => 'SUB_ACCOUNT_DRIVER',
164
+				'OWNER_MEMBER_ID' => self::$owner_member_id
165
+			], [
166
+				'new_password' => '12345&Qwerty',
167
+				'member_first_name' => 'Tusha II',
168
+				'member_last_name' => 'Pupkindzes',
169
+				'member_email' => '[email protected]',
170
+				'member_type' => 'SUB_ACCOUNT_DRIVER',
171
+				'OWNER_MEMBER_ID' => self::$owner_member_id
172
+				]
173
+		], [
174
+			'conflicts' => 'overwrite'
175
+		]);
176
+
177
+		$this->assertIsArray($result);
178
+	}
179 179
     
180
-    public static function tearDownAfterClass() : void
181
-    {
182
-        sleep(5);
183
-
184
-        $team_mng = new TeamManagement();
185
-        $result = $team_mng->getUsers();
186
-
187
-        if (is_array($result)) {
188
-            foreach ($result as $key => $member) {
189
-                if ($member->member_last_name == 'Pupkindzes') {
190
-                    $team_mng->delete($member->member_id);
191
-                }
192
-            }
193
-        }
194
-    }
180
+	public static function tearDownAfterClass() : void
181
+	{
182
+		sleep(5);
183
+
184
+		$team_mng = new TeamManagement();
185
+		$result = $team_mng->getUsers();
186
+
187
+		if (is_array($result)) {
188
+			foreach ($result as $key => $member) {
189
+				if ($member->member_last_name == 'Pupkindzes') {
190
+					$team_mng->delete($member->member_id);
191
+				}
192
+			}
193
+		}
194
+	}
195 195
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     
28 28
         if (is_array($res_members) && isset($res_members['results'])) {
29 29
             foreach ($res_members['results'] as $key => $value) {
30
-                if ($value['OWNER_MEMBER_ID'] == 0) {
30
+                if ($value['OWNER_MEMBER_ID']==0) {
31 31
                     self::$owner_member_id = $value['member_id'];
32 32
                     break;
33 33
                 }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         $result = $team_mng->getUsers();
124 124
 
125 125
         $this->assertIsArray($result);
126
-        if (count($result) > 0) {
126
+        if (count($result)>0) {
127 127
             $this->assertInstanceOf(ResponseTeam::class, $result[0]);
128 128
         }
129 129
     }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
         if (is_array($result)) {
188 188
             foreach ($result as $key => $member) {
189
-                if ($member->member_last_name == 'Pupkindzes') {
189
+                if ($member->member_last_name=='Pupkindzes') {
190 190
                     $team_mng->delete($member->member_id);
191 191
                 }
192 192
             }
Please login to merge, or discard this patch.
src/Route4Me/V5/TeamManagement/Option.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@
 block discarded – undo
13 13
  */
14 14
 class Option extends Common
15 15
 {
16
-    public ?string $value = null;
17
-    public ?string $title = null;
16
+	public ?string $value = null;
17
+	public ?string $title = null;
18 18
 
19
-    public function __construct(?array $params = null)
20
-    {
21
-        if ($params !== null) {
22
-            $this->fillFromArray($params);
23
-        }
24
-    }
19
+	public function __construct(?array $params = null)
20
+	{
21
+		if ($params !== null) {
22
+			$this->fillFromArray($params);
23
+		}
24
+	}
25 25
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 
36 36
     public function __construct(?array $params = null)
37 37
     {
38
-        if ($params !== null) {
38
+        if ($params!==null) {
39 39
             $this->fillFromArray($params);
40 40
         }
41 41
     }
Please login to merge, or discard this patch.