@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | 'url' => Endpoint::ADDRESS_BOOK_GROUP, |
| 38 | 38 | 'method' => 'GET', |
| 39 | 39 | 'query' => [ |
| 40 | - 'group_id' => isset($params['group_id']) ? $params['group_id'] : null, |
|
| 40 | + 'group_id' => isset($params['group_id']) ? $params['group_id'] : null, |
|
| 41 | 41 | ], |
| 42 | 42 | ]); |
| 43 | 43 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | 'method' => 'GET', |
| 117 | 117 | 'query' => [ |
| 118 | 118 | 'offset' => isset($params['offset']) ? $params['offset'] : null, |
| 119 | - 'limit' => isset($params['limit']) ? $params['limit'] : null, |
|
| 119 | + 'limit' => isset($params['limit']) ? $params['limit'] : null, |
|
| 120 | 120 | ], |
| 121 | 121 | ]); |
| 122 | 122 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public static function getAddressBookGroupIdByName($name) |
| 147 | 147 | { |
| 148 | - $abGroups = self::getAddressBookGroups(['offset'=>0,'limit'=>100]); |
|
| 148 | + $abGroups = self::getAddressBookGroups(['offset'=>0, 'limit'=>100]); |
|
| 149 | 149 | |
| 150 | 150 | $abGroupId = []; |
| 151 | 151 | |
@@ -67,9 +67,9 @@ |
||
| 67 | 67 | const VEHICLE_V4_API = '/api.v4/vehicle.php'; |
| 68 | 68 | |
| 69 | 69 | const TELEMATICS_VENDORS = "http://telematics.route4me.com/api/vendors.php"; |
| 70 | - const TELEMATICS_REGISTER_MEMBER = "/api.v4/telematics/register.php"; |
|
| 71 | - const TELEMATICS_CONNECTION = "/api.v4/telematics/connections.php"; |
|
| 72 | - const TELEMATICS_VENDORS_INFO = "/api.v4/telematics/vendors.php"; |
|
| 70 | + const TELEMATICS_REGISTER_MEMBER = "/api.v4/telematics/register.php"; |
|
| 71 | + const TELEMATICS_CONNECTION = "/api.v4/telematics/connections.php"; |
|
| 72 | + const TELEMATICS_VENDORS_INFO = "/api.v4/telematics/vendors.php"; |
|
| 73 | 73 | |
| 74 | 74 | const MEMBER_CAPABILITIES = "/api/member/capabilities.php"; |
| 75 | 75 | |
@@ -76,57 +76,57 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | $route = new self(); |
| 78 | 78 | |
| 79 | - $route->route_id = Common::getValue($params, 'route_id'); |
|
| 80 | - $route->organization_id = Common::getValue($params, 'organization_id'); |
|
| 81 | - $route->route_progress = Common::getValue($params, 'route_progress'); |
|
| 82 | - $route->depot_address_id = Common::getValue($params, 'depot_address_id'); |
|
| 83 | - $route->root_member_id = Common::getValue($params, 'root_member_id'); |
|
| 84 | - $route->day_id = Common::getValue($params, 'day_id'); |
|
| 85 | - $route->addresses_visited_count = Common::getValue($params, 'addresses_visited_count'); |
|
| 86 | - $route->route_start_time = Common::getValue($params, 'route_start_time'); |
|
| 87 | - $route->route_end_time = Common::getValue($params, 'route_end_time'); |
|
| 88 | - $route->user_route_rating = Common::getValue($params, 'user_route_rating'); |
|
| 89 | - $route->member_id = Common::getValue($params, 'member_id'); |
|
| 90 | - $route->member_email = Common::getValue($params, 'member_email'); |
|
| 91 | - $route->member_first_name = Common::getValue($params, 'member_first_name'); |
|
| 92 | - $route->member_last_name = Common::getValue($params, 'member_last_name'); |
|
| 93 | - $route->channel_name = Common::getValue($params, 'channel_name'); |
|
| 94 | - $route->member_picture = Common::getValue($params, 'member_picture'); |
|
| 95 | - $route->member_tracking_subheadline = Common::getValue($params, 'member_tracking_subheadline'); |
|
| 96 | - $route->approved_for_execution = Common::getValue($params, 'approved_for_execution'); |
|
| 97 | - $route->approved_revisions_counter = Common::getValue($params, 'approved_revisions_counter'); |
|
| 98 | - $route->vehicle_alias = Common::getValue($params, 'vehicle_alias'); |
|
| 99 | - $route->driver_alias = Common::getValue($params, 'driver_alias'); |
|
| 100 | - $route->mpg = Common::getValue($params, 'mpg'); |
|
| 101 | - $route->trip_distance = Common::getValue($params, 'trip_distance'); |
|
| 102 | - $route->udu_distance_unit = Common::getValue($params, 'udu_distance_unit'); |
|
| 103 | - $route->udu_trip_distance = Common::getValue($params, 'udu_trip_distance'); |
|
| 104 | - $route->is_unrouted = Common::getValue($params, 'is_unrouted'); |
|
| 105 | - $route->gas_price = Common::getValue($params, 'gas_price'); |
|
| 106 | - $route->route_duration_sec = Common::getValue($params, 'route_duration_sec'); |
|
| 107 | - $route->planned_total_route_duration = Common::getValue($params, 'planned_total_route_duration'); |
|
| 108 | - $route->total_wait_time = Common::getValue($params, 'total_wait_time'); |
|
| 109 | - $route->udu_actual_travel_distance = Common::getValue($params, 'udu_actual_travel_distance'); |
|
| 110 | - $route->actual_travel_distance = Common::getValue($params, 'actual_travel_distance'); |
|
| 111 | - $route->actual_travel_time = Common::getValue($params, 'actual_travel_time'); |
|
| 112 | - $route->actual_footsteps = Common::getValue($params, 'actual_footsteps'); |
|
| 113 | - $route->working_time = Common::getValue($params, 'working_time'); |
|
| 114 | - $route->driving_time = Common::getValue($params, 'driving_time'); |
|
| 115 | - $route->idling_time = Common::getValue($params, 'idling_time'); |
|
| 116 | - $route->paying_miles = Common::getValue($params, 'paying_miles'); |
|
| 117 | - $route->geofence_polygon_type = Common::getValue($params, 'geofence_polygon_type'); |
|
| 118 | - $route->geofence_polygon_size = Common::getValue($params, 'geofence_polygon_size'); |
|
| 119 | - $route->destination_count = Common::getValue($params, 'destination_count'); |
|
| 120 | - $route->notes_count = Common::getValue($params, 'notes_count'); |
|
| 121 | - $route->notes = Common::getValue($params, 'notes'); |
|
| 122 | - $route->directions = Common::getValue($params, 'directions'); |
|
| 123 | - $route->path = Common::getValue($params, 'path'); |
|
| 124 | - $route->vehicle = Common::getValue($params, 'vehicle'); |
|
| 125 | - $route->member_config_storage = Common::getValue($params, 'member_config_storage'); |
|
| 126 | - $route->is_master = Common::getValue($params, 'is_master'); |
|
| 127 | - $route->bundle_items = Common::getValue($params, 'bundle_items'); |
|
| 128 | - $route->master_route_id = Common::getValue($params, 'master_route_id'); |
|
| 129 | - $route->route_status = Common::getValue($params, 'route_status'); |
|
| 79 | + $route->route_id = Common::getValue($params, 'route_id'); |
|
| 80 | + $route->organization_id = Common::getValue($params, 'organization_id'); |
|
| 81 | + $route->route_progress = Common::getValue($params, 'route_progress'); |
|
| 82 | + $route->depot_address_id = Common::getValue($params, 'depot_address_id'); |
|
| 83 | + $route->root_member_id = Common::getValue($params, 'root_member_id'); |
|
| 84 | + $route->day_id = Common::getValue($params, 'day_id'); |
|
| 85 | + $route->addresses_visited_count = Common::getValue($params, 'addresses_visited_count'); |
|
| 86 | + $route->route_start_time = Common::getValue($params, 'route_start_time'); |
|
| 87 | + $route->route_end_time = Common::getValue($params, 'route_end_time'); |
|
| 88 | + $route->user_route_rating = Common::getValue($params, 'user_route_rating'); |
|
| 89 | + $route->member_id = Common::getValue($params, 'member_id'); |
|
| 90 | + $route->member_email = Common::getValue($params, 'member_email'); |
|
| 91 | + $route->member_first_name = Common::getValue($params, 'member_first_name'); |
|
| 92 | + $route->member_last_name = Common::getValue($params, 'member_last_name'); |
|
| 93 | + $route->channel_name = Common::getValue($params, 'channel_name'); |
|
| 94 | + $route->member_picture = Common::getValue($params, 'member_picture'); |
|
| 95 | + $route->member_tracking_subheadline = Common::getValue($params, 'member_tracking_subheadline'); |
|
| 96 | + $route->approved_for_execution = Common::getValue($params, 'approved_for_execution'); |
|
| 97 | + $route->approved_revisions_counter = Common::getValue($params, 'approved_revisions_counter'); |
|
| 98 | + $route->vehicle_alias = Common::getValue($params, 'vehicle_alias'); |
|
| 99 | + $route->driver_alias = Common::getValue($params, 'driver_alias'); |
|
| 100 | + $route->mpg = Common::getValue($params, 'mpg'); |
|
| 101 | + $route->trip_distance = Common::getValue($params, 'trip_distance'); |
|
| 102 | + $route->udu_distance_unit = Common::getValue($params, 'udu_distance_unit'); |
|
| 103 | + $route->udu_trip_distance = Common::getValue($params, 'udu_trip_distance'); |
|
| 104 | + $route->is_unrouted = Common::getValue($params, 'is_unrouted'); |
|
| 105 | + $route->gas_price = Common::getValue($params, 'gas_price'); |
|
| 106 | + $route->route_duration_sec = Common::getValue($params, 'route_duration_sec'); |
|
| 107 | + $route->planned_total_route_duration = Common::getValue($params, 'planned_total_route_duration'); |
|
| 108 | + $route->total_wait_time = Common::getValue($params, 'total_wait_time'); |
|
| 109 | + $route->udu_actual_travel_distance = Common::getValue($params, 'udu_actual_travel_distance'); |
|
| 110 | + $route->actual_travel_distance = Common::getValue($params, 'actual_travel_distance'); |
|
| 111 | + $route->actual_travel_time = Common::getValue($params, 'actual_travel_time'); |
|
| 112 | + $route->actual_footsteps = Common::getValue($params, 'actual_footsteps'); |
|
| 113 | + $route->working_time = Common::getValue($params, 'working_time'); |
|
| 114 | + $route->driving_time = Common::getValue($params, 'driving_time'); |
|
| 115 | + $route->idling_time = Common::getValue($params, 'idling_time'); |
|
| 116 | + $route->paying_miles = Common::getValue($params, 'paying_miles'); |
|
| 117 | + $route->geofence_polygon_type = Common::getValue($params, 'geofence_polygon_type'); |
|
| 118 | + $route->geofence_polygon_size = Common::getValue($params, 'geofence_polygon_size'); |
|
| 119 | + $route->destination_count = Common::getValue($params, 'destination_count'); |
|
| 120 | + $route->notes_count = Common::getValue($params, 'notes_count'); |
|
| 121 | + $route->notes = Common::getValue($params, 'notes'); |
|
| 122 | + $route->directions = Common::getValue($params, 'directions'); |
|
| 123 | + $route->path = Common::getValue($params, 'path'); |
|
| 124 | + $route->vehicle = Common::getValue($params, 'vehicle'); |
|
| 125 | + $route->member_config_storage = Common::getValue($params, 'member_config_storage'); |
|
| 126 | + $route->is_master = Common::getValue($params, 'is_master'); |
|
| 127 | + $route->bundle_items = Common::getValue($params, 'bundle_items'); |
|
| 128 | + $route->master_route_id = Common::getValue($params, 'master_route_id'); |
|
| 129 | + $route->route_status = Common::getValue($params, 'route_status'); |
|
| 130 | 130 | |
| 131 | 131 | if (isset($params['vehicle'])) { |
| 132 | 132 | $route->vehicle = new Vehicle(); |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | { |
| 291 | 291 | $routeId = ""; |
| 292 | 292 | foreach ($routeIDs as $rid) { |
| 293 | - $routeId.=$rid.','; |
|
| 293 | + $routeId .= $rid.','; |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | $routeId = rtrim($routeId, ','); |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | |
| 395 | 395 | public function mergeRoutes($params) |
| 396 | 396 | { |
| 397 | - $allBodyFields = ['route_ids', 'depot_address', 'remove_origin', 'depot_lat', 'depot_lng']; |
|
| 397 | + $allBodyFields = ['route_ids', 'depot_address', 'remove_origin', 'depot_lat', 'depot_lng']; |
|
| 398 | 398 | |
| 399 | 399 | $result = Route4Me::makeRequst([ |
| 400 | 400 | 'url' => Endpoint::ROUTES_MERGE, |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | $route = new self(); |
| 434 | 434 | $routes = $route->getRoutes($params); |
| 435 | 435 | |
| 436 | - if (is_null($routes) || sizeof($routes) < 1) { |
|
| 436 | + if (is_null($routes) || sizeof($routes)<1) { |
|
| 437 | 437 | echo '<br> There are no routes in the account. Please, create the routes first. <br>'; |
| 438 | 438 | |
| 439 | 439 | return null; |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | public function updateRoute($params) |
| 448 | 448 | { |
| 449 | - $allQueryFields = ['route_id', 'reoptimize','route_destination_id']; |
|
| 449 | + $allQueryFields = ['route_id', 'reoptimize', 'route_destination_id']; |
|
| 450 | 450 | $allBodyFields = ['addresses', 'parameters', 'unlink_from_master_optimization']; |
| 451 | 451 | |
| 452 | 452 | $result = Route4Me::makeRequst([ |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | |
| 481 | 481 | public function updateAddress($address = null) |
| 482 | 482 | { |
| 483 | - $body = sizeof($this->addresses) < 1 ? get_object_vars($this->parameters) |
|
| 483 | + $body = sizeof($this->addresses)<1 ? get_object_vars($this->parameters) |
|
| 484 | 484 | : (isset($this->addresses[0]) ? $this->addresses[0] : get_object_vars($this->parameters)); |
| 485 | 485 | |
| 486 | 486 | $result = Route4Me::makeRequst([ |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | $param->addAddress($address); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - if (isset($params['depots'] )) { |
|
| 47 | + if (isset($params['depots'])) { |
|
| 48 | 48 | foreach ($params['depots'] as $depot) { |
| 49 | 49 | if (!($depot instanceof AddressV5)) { |
| 50 | 50 | $depot = AddressV5::fromArray($depot); |
@@ -127,7 +127,7 @@ |
||
| 127 | 127 | public static function get($params) |
| 128 | 128 | { |
| 129 | 129 | $allQueryFields = ['state', 'limit', 'format', 'offset', |
| 130 | - 'optimization_problem_id', 'wait_for_final_state','start_date','end_date', ]; |
|
| 130 | + 'optimization_problem_id', 'wait_for_final_state', 'start_date', 'end_date', ]; |
|
| 131 | 131 | |
| 132 | 132 | $result = Route4Me::makeRequst([ |
| 133 | 133 | 'url' => \Route4Me\Enum\Endpoint::OPTIMIZATION_PROBLEM, |
@@ -548,7 +548,7 @@ |
||
| 548 | 548 | public function __construct() |
| 549 | 549 | { |
| 550 | 550 | // TO DO: replace with API 5 endpoint after finishing. |
| 551 | - Route4Me::setBaseUrl( Endpoint4::BASE_URL); |
|
| 551 | + Route4Me::setBaseUrl(Endpoint4::BASE_URL); |
|
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | public static function fromArray(array $params) |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | //$vehicleProfileID = isset($params['vehicle_profile_id']) ? $params['vehicle_profile_id'] : null; |
| 194 | 194 | |
| 195 | 195 | $response = Route4Me::makeRequst([ |
| 196 | - 'url' => Endpoint::VehicleProfiles . '/' . $vehicleProfileId, |
|
| 196 | + 'url' => Endpoint::VehicleProfiles.'/'.$vehicleProfileId, |
|
| 197 | 197 | 'method' => 'DELETE', |
| 198 | 198 | 'HTTPHEADER' => 'Content-Type: application/json; Accept: application/json', |
| 199 | 199 | ]); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | public function getVehicleProfileById($vehicleProfileId) |
| 243 | 243 | { |
| 244 | 244 | $response = Route4Me::makeRequst([ |
| 245 | - 'url' => Endpoint::VehicleProfiles . '/' . $vehicleProfileId, |
|
| 245 | + 'url' => Endpoint::VehicleProfiles.'/'.$vehicleProfileId, |
|
| 246 | 246 | 'method' => 'GET', |
| 247 | 247 | ]); |
| 248 | 248 | |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | $param->addAddress($address); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if (isset($params['depots'] )) { |
|
| 45 | + if (isset($params['depots'])) { |
|
| 46 | 46 | foreach ($params['depots'] as $depot) { |
| 47 | 47 | if (!($depot instanceof Address)) { |
| 48 | 48 | $depot = Address::fromArray($depot); |
@@ -11,8 +11,8 @@ |
||
| 11 | 11 | |
| 12 | 12 | public function toArray() |
| 13 | 13 | { |
| 14 | - $params = array_filter(get_object_vars($this), function ($item) { |
|
| 15 | - return (null !== $item) && !(is_array($item) && !count($item)); |
|
| 14 | + $params = array_filter(get_object_vars($this), function($item) { |
|
| 15 | + return (null!==$item) && !(is_array($item) && !count($item)); |
|
| 16 | 16 | }); |
| 17 | 17 | |
| 18 | 18 | return $params; |