@@ -400,7 +400,7 @@ |
||
| 400 | 400 | $this->assertInstanceOf(ResponsePagination::class, $result); |
| 401 | 401 | $this->assertNotNull($result->current_page); |
| 402 | 402 | $this->assertIsArray($result->results); |
| 403 | - if (count($result->results) > 0) { |
|
| 403 | + if (count($result->results)>0) { |
|
| 404 | 404 | $this->assertInstanceOf(ResponseAddress::class, $result->results[0]); |
| 405 | 405 | } |
| 406 | 406 | } |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | $vehicleProfile = new VehicleProfile(); |
| 529 | 529 | |
| 530 | - $vehProfileId = self::$createdVehicleProfiles[sizeof(self::$createdVehicleProfiles)-1]['vehicle_profile_id']; |
|
| 530 | + $vehProfileId = self::$createdVehicleProfiles[sizeof(self::$createdVehicleProfiles) - 1]['vehicle_profile_id']; |
|
| 531 | 531 | |
| 532 | 532 | $result = $vehicleProfile->removeVehicleProfile($vehProfileId); |
| 533 | 533 | |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | |
| 548 | 548 | $vehicleProfile = new VehicleProfile(); |
| 549 | 549 | |
| 550 | - $vehProfileId = self::$createdVehicleProfiles[sizeof(self::$createdVehicleProfiles)-1]['vehicle_profile_id']; |
|
| 550 | + $vehProfileId = self::$createdVehicleProfiles[sizeof(self::$createdVehicleProfiles) - 1]['vehicle_profile_id']; |
|
| 551 | 551 | |
| 552 | 552 | $result = $vehicleProfile->getVehicleProfileById($vehProfileId); |
| 553 | 553 | |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | { |
| 604 | 604 | $vehicle = new Vehicle(); |
| 605 | 605 | |
| 606 | - $vehicle->vehicle_alias = self::$createdVehicles[0]['vehicle_alias'] .' Updated'; |
|
| 606 | + $vehicle->vehicle_alias = self::$createdVehicles[0]['vehicle_alias'].' Updated'; |
|
| 607 | 607 | $vehicle->vehicle_vin = '11111111111111111'; |
| 608 | 608 | $vehicle->vehicle_id = self::$createdVehicles[0]['vehicle_id']; |
| 609 | 609 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | public function getSchedule(string $scheduleId) : Schedule |
| 68 | 68 | { |
| 69 | 69 | return $this->toSchedule(Route4Me::makeRequst([ |
| 70 | - 'url' => Endpoint::RECURRING_ROUTES_SCHEDULES . '/' . $scheduleId, |
|
| 70 | + 'url' => Endpoint::RECURRING_ROUTES_SCHEDULES.'/'.$scheduleId, |
|
| 71 | 71 | 'method' => 'GET' |
| 72 | 72 | ])); |
| 73 | 73 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | 'advance_interval', 'advance_schedule_interval_days', 'schedule', 'timezone']; |
| 164 | 164 | |
| 165 | 165 | return $this->toSchedule(Route4Me::makeRequst([ |
| 166 | - 'url' => Endpoint::RECURRING_ROUTES_SCHEDULES . '/' . $scheduleId, |
|
| 166 | + 'url' => Endpoint::RECURRING_ROUTES_SCHEDULES.'/'.$scheduleId, |
|
| 167 | 167 | 'method' => 'PUT', |
| 168 | 168 | 'HTTPHEADER' => 'Content-Type: application/json', |
| 169 | 169 | 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | public function deleteSchedule(string $scheduleId, bool $withRoutes = false) : Schedule |
| 186 | 186 | { |
| 187 | 187 | return $this->toSchedule(Route4Me::makeRequst([ |
| 188 | - 'url' => Endpoint::RECURRING_ROUTES_SCHEDULES . '/' . $scheduleId, |
|
| 188 | + 'url' => Endpoint::RECURRING_ROUTES_SCHEDULES.'/'.$scheduleId, |
|
| 189 | 189 | 'method' => 'DELETE', |
| 190 | 190 | 'query' => ['with_routes' => $withRoutes] |
| 191 | 191 | ])); |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | public function getRouteSchedule(string $route_id) : RouteSchedule |
| 229 | 229 | { |
| 230 | 230 | return $this->toRouteSchedule(Route4Me::makeRequst([ |
| 231 | - 'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id, |
|
| 231 | + 'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES.'/'.$route_id, |
|
| 232 | 232 | 'method' => 'GET' |
| 233 | 233 | ])); |
| 234 | 234 | } |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | $allBodyFields = ['schedule_uid', 'member_id', 'vehicle_id']; |
| 318 | 318 | |
| 319 | 319 | return $this->toRouteSchedule(Route4Me::makeRequst([ |
| 320 | - 'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id, |
|
| 320 | + 'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES.'/'.$route_id, |
|
| 321 | 321 | 'method' => 'PUT', |
| 322 | 322 | 'HTTPHEADER' => 'Content-Type: application/json', |
| 323 | 323 | 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | public function deleteRouteSchedules(string $route_id) : bool |
| 337 | 337 | { |
| 338 | 338 | $result = Route4Me::makeRequst([ |
| 339 | - 'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id, |
|
| 339 | + 'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES.'/'.$route_id, |
|
| 340 | 340 | 'method' => 'DELETE' |
| 341 | 341 | ]); |
| 342 | 342 | return (isset($result['status']) ? $result['status'] : false); |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | public function deleteRouteSchedule(string $route_id) : RouteSchedule |
| 355 | 355 | { |
| 356 | 356 | return $this->toRouteSchedule(Route4Me::makeRequst([ |
| 357 | - 'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id . '/items', |
|
| 357 | + 'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES.'/'.$route_id.'/items', |
|
| 358 | 358 | 'method' => 'DELETE' |
| 359 | 359 | ])); |
| 360 | 360 | } |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | 'advance_interval', 'advance_schedule_interval_days', 'schedule', 'timezone']; |
| 386 | 386 | |
| 387 | 387 | return $this->toRouteSchedule(Route4Me::makeRequst([ |
| 388 | - 'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES_REPLACE . '/' . $route_id, |
|
| 388 | + 'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES_REPLACE.'/'.$route_id, |
|
| 389 | 389 | 'method' => 'PUT', |
| 390 | 390 | 'HTTPHEADER' => 'Content-Type: application/json', |
| 391 | 391 | 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | public function getRouteSchedulePreview(string $route_id, string $start, string $end) : array |
| 407 | 407 | { |
| 408 | 408 | return Route4Me::makeRequst([ |
| 409 | - 'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES . '/' . $route_id . '/preview', |
|
| 409 | + 'url' => Endpoint::RECURRING_ROUTES_ROUTE_SCHEDULES.'/'.$route_id.'/preview', |
|
| 410 | 410 | 'method' => 'GET', |
| 411 | 411 | 'query' => ['start' => $start, 'end' => $end] |
| 412 | 412 | ]); |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | public function isScheduledRouteCopy(string $route_id) : bool |
| 425 | 425 | { |
| 426 | 426 | $result = Route4Me::makeRequst([ |
| 427 | - 'url' => Endpoint::RECURRING_ROUTES_SCHEDULED_ROUTES_IS_COPY . '/' . $route_id, |
|
| 427 | + 'url' => Endpoint::RECURRING_ROUTES_SCHEDULED_ROUTES_IS_COPY.'/'.$route_id, |
|
| 428 | 428 | 'method' => 'GET' |
| 429 | 429 | ]); |
| 430 | 430 | return (isset($result['status']) ? $result['status'] : false); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | $method = isset($options['method']) ? $options['method'] : 'GET'; |
| 56 | 56 | $query = isset($options['query']) |
| 57 | - ? array_filter($options['query'], function ($x) { |
|
| 57 | + ? array_filter($options['query'], function($x) { |
|
| 58 | 58 | return !is_null($x); |
| 59 | 59 | }) : []; |
| 60 | 60 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $ch = curl_init(); |
| 80 | 80 | |
| 81 | 81 | $url = isset($options['url']) |
| 82 | - ? $options['url'] . '?' . http_build_query(array_merge( |
|
| 82 | + ? $options['url'].'?'.http_build_query(array_merge( |
|
| 83 | 83 | $query, |
| 84 | 84 | ['api_key' => self::getApiKey()] |
| 85 | 85 | )) : ''; |
@@ -101,19 +101,19 @@ discard block |
||
| 101 | 101 | // read response headers if need |
| 102 | 102 | $response_headers = []; |
| 103 | 103 | if ($return_headers) { |
| 104 | - curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($curl, $header) use (&$response_headers) { |
|
| 104 | + curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$response_headers) { |
|
| 105 | 105 | $len = strlen($header); |
| 106 | 106 | $header = explode(':', $header, 2); |
| 107 | - if (count($header) >= 2) { |
|
| 107 | + if (count($header)>=2) { |
|
| 108 | 108 | $response_headers[strtolower(trim($header[0]))] = trim($header[1]); |
| 109 | 109 | } |
| 110 | 110 | return $len; |
| 111 | 111 | }); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if (null != $file) { |
|
| 114 | + if (null!=$file) { |
|
| 115 | 115 | $cfile = new \CURLFile($file, '', ''); |
| 116 | - $body['strFilename']=$cfile; |
|
| 116 | + $body['strFilename'] = $cfile; |
|
| 117 | 117 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
| 118 | 118 | curl_setopt($ch, CURLOPT_POST, true); |
| 119 | 119 | curl_setopt($ch, CURLOPT_POSTFIELDS, $body); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | case 'POST': |
| 133 | 133 | if (isset($body)) { |
| 134 | 134 | if (isset($options['HTTPHEADER']) |
| 135 | - && strpos($options['HTTPHEADER'], 'multipart/form-data') > 0) { |
|
| 135 | + && strpos($options['HTTPHEADER'], 'multipart/form-data')>0) { |
|
| 136 | 136 | $bodyData = $body; |
| 137 | 137 | } else { |
| 138 | 138 | $bodyData = json_encode($body); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | if (isset($body)) { |
| 150 | 150 | $bodyData = json_encode($body); |
| 151 | 151 | if (isset($options['HTTPHEADER'])) { |
| 152 | - if (strpos($options['HTTPHEADER'], 'multipart/form-data') > 0) { |
|
| 152 | + if (strpos($options['HTTPHEADER'], 'multipart/form-data')>0) { |
|
| 153 | 153 | $bodyData = $body; |
| 154 | 154 | } |
| 155 | 155 | } |
@@ -171,18 +171,18 @@ discard block |
||
| 171 | 171 | curl_close($ch); |
| 172 | 172 | |
| 173 | 173 | $json = null; |
| 174 | - if (strpos($result, '<?xml') > -1) { |
|
| 174 | + if (strpos($result, '<?xml')>-1) { |
|
| 175 | 175 | $xml = simplexml_load_string($result); |
| 176 | 176 | $json = self::object2array($xml); |
| 177 | 177 | } else { |
| 178 | 178 | $json = json_decode($result, true); |
| 179 | 179 | } |
| 180 | - if (200 == $code || 201 == $code || 202 == $code) { |
|
| 180 | + if (200==$code || 201==$code || 202==$code) { |
|
| 181 | 181 | if (isset($json['errors'])) { |
| 182 | 182 | throw new ApiError(implode(', ', $json['errors']), $code, $result); |
| 183 | 183 | } else { |
| 184 | 184 | // return response headers if they were asked for |
| 185 | - if (count($response_headers) !== 0) { |
|
| 185 | + if (count($response_headers)!==0) { |
|
| 186 | 186 | $res = [ |
| 187 | 187 | 'code' => $code, |
| 188 | 188 | 'data' => $json |
@@ -202,10 +202,10 @@ discard block |
||
| 202 | 202 | if (isset($json['messages'])) { |
| 203 | 203 | $msg = ''; |
| 204 | 204 | foreach ($json['messages'] as $key => $value) { |
| 205 | - if ($msg !== '') { |
|
| 205 | + if ($msg!=='') { |
|
| 206 | 206 | $msg .= PHP_EOL; |
| 207 | 207 | } |
| 208 | - $msg .= $key . ': ' . (is_array($value) ? implode(', ', $value) : $value); |
|
| 208 | + $msg .= $key.': '.(is_array($value) ? implode(', ', $value) : $value); |
|
| 209 | 209 | } |
| 210 | 210 | throw new ApiError($msg, $code, $result); |
| 211 | 211 | } elseif (isset($json['error']) && !empty($json['error'])) { |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | } elseif (isset($json['error'])) { |
| 214 | 214 | $msg = ''; |
| 215 | 215 | foreach ($json['errors'] as $key => $value) { |
| 216 | - if ($msg !== '') { |
|
| 216 | + if ($msg!=='') { |
|
| 217 | 217 | $msg .= PHP_EOL; |
| 218 | 218 | } |
| 219 | 219 | $msg .= $value; |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | if (is_object($result1)) { |
| 259 | 259 | if ($deepPrinting) { |
| 260 | 260 | echo "<br>$key1 ------><br>"; |
| 261 | - $oarray = (array) $result1; |
|
| 261 | + $oarray = (array)$result1; |
|
| 262 | 262 | self::simplePrint($oarray, true); |
| 263 | 263 | echo '------<br>'; |
| 264 | 264 | } else { |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | if (is_object($result)) { |
| 276 | 276 | if ($deepPrinting) { |
| 277 | 277 | echo "<br>$key ------><br>"; |
| 278 | - $oarray = (array) $result; |
|
| 278 | + $oarray = (array)$result; |
|
| 279 | 279 | self::simplePrint($oarray, true); |
| 280 | 280 | echo '------<br>'; |
| 281 | 281 | } else { |