@@ -11,279 +11,279 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class TelematicsConnection extends \Route4Me\Common |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * Telematics connection access account_id |
|
| 16 | - * @var string |
|
| 17 | - */ |
|
| 18 | - public $account_id; |
|
| 14 | + /** |
|
| 15 | + * Telematics connection access account_id |
|
| 16 | + * @var string |
|
| 17 | + */ |
|
| 18 | + public $account_id; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Telematics connection access username |
|
| 22 | - * @var string |
|
| 23 | - */ |
|
| 24 | - public $username; |
|
| 20 | + /** |
|
| 21 | + * Telematics connection access username |
|
| 22 | + * @var string |
|
| 23 | + */ |
|
| 24 | + public $username; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Telematics connection access password |
|
| 28 | - * @var string |
|
| 29 | - */ |
|
| 30 | - public $password; |
|
| 26 | + /** |
|
| 27 | + * Telematics connection access password |
|
| 28 | + * @var string |
|
| 29 | + */ |
|
| 30 | + public $password; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Telematics connection access host |
|
| 34 | - * @var string |
|
| 35 | - */ |
|
| 36 | - public $host; |
|
| 32 | + /** |
|
| 33 | + * Telematics connection access host |
|
| 34 | + * @var string |
|
| 35 | + */ |
|
| 36 | + public $host; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Telematics connection access api_key |
|
| 40 | - * @var string |
|
| 41 | - */ |
|
| 42 | - public $api_key; |
|
| 38 | + /** |
|
| 39 | + * Telematics connection access api_key |
|
| 40 | + * @var string |
|
| 41 | + */ |
|
| 42 | + public $api_key; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Telemetics connection type ID |
|
| 46 | - * @var integer |
|
| 47 | - */ |
|
| 48 | - public $vendor_id; |
|
| 44 | + /** |
|
| 45 | + * Telemetics connection type ID |
|
| 46 | + * @var integer |
|
| 47 | + */ |
|
| 48 | + public $vendor_id; |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * Telemetics connection name |
|
| 52 | - * @var string |
|
| 53 | - */ |
|
| 54 | - public $name; |
|
| 50 | + /** |
|
| 51 | + * Telemetics connection name |
|
| 52 | + * @var string |
|
| 53 | + */ |
|
| 54 | + public $name; |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Vehicle tracking interval in seconds. |
|
| 58 | - * @var integer |
|
| 59 | - */ |
|
| 60 | - public $vehicle_position_refresh_rate; |
|
| 56 | + /** |
|
| 57 | + * Vehicle tracking interval in seconds. |
|
| 58 | + * @var integer |
|
| 59 | + */ |
|
| 60 | + public $vehicle_position_refresh_rate; |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Maximum idle time |
|
| 64 | - * @var integer |
|
| 65 | - */ |
|
| 66 | - public $max_idle_time; |
|
| 62 | + /** |
|
| 63 | + * Maximum idle time |
|
| 64 | + * @var integer |
|
| 65 | + */ |
|
| 66 | + public $max_idle_time; |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Disable/enable vehicle tracking |
|
| 70 | - * @var integer |
|
| 71 | - */ |
|
| 72 | - public $is_enabled; |
|
| 68 | + /** |
|
| 69 | + * Disable/enable vehicle tracking |
|
| 70 | + * @var integer |
|
| 71 | + */ |
|
| 72 | + public $is_enabled; |
|
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * The last timestamp, when the vehicles reloaded. |
|
| 76 | - * @var integer |
|
| 77 | - */ |
|
| 78 | - public $last_vehicles_reload; |
|
| 74 | + /** |
|
| 75 | + * The last timestamp, when the vehicles reloaded. |
|
| 76 | + * @var integer |
|
| 77 | + */ |
|
| 78 | + public $last_vehicles_reload; |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * The last timestamp, when the addresses reloaded. |
|
| 82 | - * @var integer |
|
| 83 | - */ |
|
| 84 | - public $last_addresses_reload; |
|
| 80 | + /** |
|
| 81 | + * The last timestamp, when the addresses reloaded. |
|
| 82 | + * @var integer |
|
| 83 | + */ |
|
| 84 | + public $last_addresses_reload; |
|
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * The last timestamp, when the positions reloaded. |
|
| 88 | - * @var integer |
|
| 89 | - */ |
|
| 90 | - public $last_position_reload; |
|
| 86 | + /** |
|
| 87 | + * The last timestamp, when the positions reloaded. |
|
| 88 | + * @var integer |
|
| 89 | + */ |
|
| 90 | + public $last_position_reload; |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Telematics connection access token |
|
| 94 | - * @var string |
|
| 95 | - */ |
|
| 96 | - public $connection_token; |
|
| 92 | + /** |
|
| 93 | + * Telematics connection access token |
|
| 94 | + * @var string |
|
| 95 | + */ |
|
| 96 | + public $connection_token; |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * Connection user ID |
|
| 100 | - * @var integer |
|
| 101 | - */ |
|
| 102 | - public $user_id; |
|
| 98 | + /** |
|
| 99 | + * Connection user ID |
|
| 100 | + * @var integer |
|
| 101 | + */ |
|
| 102 | + public $user_id; |
|
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * When the connection updated |
|
| 106 | - * @var string |
|
| 107 | - */ |
|
| 108 | - public $updated_at; |
|
| 104 | + /** |
|
| 105 | + * When the connection updated |
|
| 106 | + * @var string |
|
| 107 | + */ |
|
| 108 | + public $updated_at; |
|
| 109 | 109 | |
| 110 | - /** |
|
| 111 | - * When the connection created |
|
| 112 | - * @var string |
|
| 113 | - */ |
|
| 114 | - public $created_at; |
|
| 110 | + /** |
|
| 111 | + * When the connection created |
|
| 112 | + * @var string |
|
| 113 | + */ |
|
| 114 | + public $created_at; |
|
| 115 | 115 | |
| 116 | - /** |
|
| 117 | - * Telemetics connection ID |
|
| 118 | - * @var integer |
|
| 119 | - */ |
|
| 120 | - public $id; |
|
| 116 | + /** |
|
| 117 | + * Telemetics connection ID |
|
| 118 | + * @var integer |
|
| 119 | + */ |
|
| 120 | + public $id; |
|
| 121 | 121 | |
| 122 | - /** |
|
| 123 | - * Metadata, custom key-value storage. |
|
| 124 | - * @var array |
|
| 125 | - */ |
|
| 126 | - public $metadata; |
|
| 122 | + /** |
|
| 123 | + * Metadata, custom key-value storage. |
|
| 124 | + * @var array |
|
| 125 | + */ |
|
| 126 | + public $metadata; |
|
| 127 | 127 | |
| 128 | - /** |
|
| 129 | - * Total vehicles number |
|
| 130 | - * @var integer |
|
| 131 | - */ |
|
| 132 | - public $total_vehicles_count; |
|
| 128 | + /** |
|
| 129 | + * Total vehicles number |
|
| 130 | + * @var integer |
|
| 131 | + */ |
|
| 132 | + public $total_vehicles_count; |
|
| 133 | 133 | |
| 134 | - /** |
|
| 135 | - * Total addresses number |
|
| 136 | - * @var integer |
|
| 137 | - */ |
|
| 138 | - public $total_addresses_count; |
|
| 134 | + /** |
|
| 135 | + * Total addresses number |
|
| 136 | + * @var integer |
|
| 137 | + */ |
|
| 138 | + public $total_addresses_count; |
|
| 139 | 139 | |
| 140 | - /** |
|
| 141 | - * Synchronized vehicles number |
|
| 142 | - * @var integer |
|
| 143 | - */ |
|
| 144 | - public $synced_vehicles_count; |
|
| 140 | + /** |
|
| 141 | + * Synchronized vehicles number |
|
| 142 | + * @var integer |
|
| 143 | + */ |
|
| 144 | + public $synced_vehicles_count; |
|
| 145 | 145 | |
| 146 | - /** |
|
| 147 | - * Telemetics connection vendor |
|
| 148 | - * @var string |
|
| 149 | - */ |
|
| 150 | - public $vendor; |
|
| 146 | + /** |
|
| 147 | + * Telemetics connection vendor |
|
| 148 | + * @var string |
|
| 149 | + */ |
|
| 150 | + public $vendor; |
|
| 151 | 151 | |
| 152 | - /** |
|
| 153 | - * Validate connections credentials.<br> |
|
| 154 | - * If true, the connection validated. |
|
| 155 | - * @var Boolean |
|
| 156 | - */ |
|
| 157 | - public $validate_remote_credentials; |
|
| 152 | + /** |
|
| 153 | + * Validate connections credentials.<br> |
|
| 154 | + * If true, the connection validated. |
|
| 155 | + * @var Boolean |
|
| 156 | + */ |
|
| 157 | + public $validate_remote_credentials; |
|
| 158 | 158 | |
| 159 | - public static function fromArray(array $params) |
|
| 160 | - { |
|
| 161 | - $thisParams = new self(); |
|
| 159 | + public static function fromArray(array $params) |
|
| 160 | + { |
|
| 161 | + $thisParams = new self(); |
|
| 162 | 162 | |
| 163 | - foreach ($params as $key => $value) { |
|
| 164 | - if (property_exists($thisParams, $key)) { |
|
| 165 | - $thisParams->{$key} = $value; |
|
| 166 | - } |
|
| 167 | - } |
|
| 163 | + foreach ($params as $key => $value) { |
|
| 164 | + if (property_exists($thisParams, $key)) { |
|
| 165 | + $thisParams->{$key} = $value; |
|
| 166 | + } |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | - return $thisParams; |
|
| 170 | - } |
|
| 169 | + return $thisParams; |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | - /** |
|
| 173 | - * Create a telematics connection. |
|
| 174 | - * @param $apiToken string : API token |
|
| 175 | - * @param $params TelematicsConnectionParameters : Telematics connection parameters |
|
| 176 | - * @return array Array from a TelematicsConnection type object |
|
| 177 | - * @throws \Route4Me\Exception\ApiError |
|
| 178 | - */ |
|
| 179 | - public function createTelematicsConnection($apiToken, $params) |
|
| 180 | - { |
|
| 181 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 172 | + /** |
|
| 173 | + * Create a telematics connection. |
|
| 174 | + * @param $apiToken string : API token |
|
| 175 | + * @param $params TelematicsConnectionParameters : Telematics connection parameters |
|
| 176 | + * @return array Array from a TelematicsConnection type object |
|
| 177 | + * @throws \Route4Me\Exception\ApiError |
|
| 178 | + */ |
|
| 179 | + public function createTelematicsConnection($apiToken, $params) |
|
| 180 | + { |
|
| 181 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 182 | 182 | |
| 183 | - $excludeFields = ['id', 'connection_token']; |
|
| 183 | + $excludeFields = ['id', 'connection_token']; |
|
| 184 | 184 | |
| 185 | - $allBodyFields = Route4Me::getObjectProperties(new TelematicsConnectionParameters(), $excludeFields); |
|
| 185 | + $allBodyFields = Route4Me::getObjectProperties(new TelematicsConnectionParameters(), $excludeFields); |
|
| 186 | 186 | |
| 187 | - $result = Route4Me::makeRequst([ |
|
| 188 | - 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 189 | - 'method' => 'POST', |
|
| 190 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 191 | - 'query' => ['api_token' => $apiToken], |
|
| 192 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
| 193 | - ]); |
|
| 187 | + $result = Route4Me::makeRequst([ |
|
| 188 | + 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 189 | + 'method' => 'POST', |
|
| 190 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 191 | + 'query' => ['api_token' => $apiToken], |
|
| 192 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
| 193 | + ]); |
|
| 194 | 194 | |
| 195 | - return $result; |
|
| 196 | - } |
|
| 195 | + return $result; |
|
| 196 | + } |
|
| 197 | 197 | |
| 198 | - /** |
|
| 199 | - * Delete a telematics connection. |
|
| 200 | - * @param $apiToken string : API token |
|
| 201 | - * @param $connectionToken string : connection token |
|
| 202 | - * @return array Array from a TelematicsConnection type object |
|
| 203 | - * @throws \Route4Me\Exception\ApiError |
|
| 204 | - */ |
|
| 205 | - public function deleteTelematicsConnection($apiToken, $connectionToken) |
|
| 206 | - { |
|
| 207 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 198 | + /** |
|
| 199 | + * Delete a telematics connection. |
|
| 200 | + * @param $apiToken string : API token |
|
| 201 | + * @param $connectionToken string : connection token |
|
| 202 | + * @return array Array from a TelematicsConnection type object |
|
| 203 | + * @throws \Route4Me\Exception\ApiError |
|
| 204 | + */ |
|
| 205 | + public function deleteTelematicsConnection($apiToken, $connectionToken) |
|
| 206 | + { |
|
| 207 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 208 | 208 | |
| 209 | - $result = Route4Me::makeRequst([ |
|
| 210 | - 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 211 | - 'method' => 'DELETE', |
|
| 212 | - 'query' => [ |
|
| 213 | - 'api_token' => $apiToken, |
|
| 214 | - 'connection_token' => $connectionToken |
|
| 215 | - ], |
|
| 216 | - ]); |
|
| 209 | + $result = Route4Me::makeRequst([ |
|
| 210 | + 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 211 | + 'method' => 'DELETE', |
|
| 212 | + 'query' => [ |
|
| 213 | + 'api_token' => $apiToken, |
|
| 214 | + 'connection_token' => $connectionToken |
|
| 215 | + ], |
|
| 216 | + ]); |
|
| 217 | 217 | |
| 218 | - return $result; |
|
| 219 | - } |
|
| 218 | + return $result; |
|
| 219 | + } |
|
| 220 | 220 | |
| 221 | - /** |
|
| 222 | - * Get all telematics connections. |
|
| 223 | - * @param $apiToken string : API token |
|
| 224 | - * @return array Array of the TelematicsConnection type objects |
|
| 225 | - * @throws \Route4Me\Exception\ApiError |
|
| 226 | - */ |
|
| 227 | - public function getTelematicsConnections($apiToken) |
|
| 228 | - { |
|
| 229 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 221 | + /** |
|
| 222 | + * Get all telematics connections. |
|
| 223 | + * @param $apiToken string : API token |
|
| 224 | + * @return array Array of the TelematicsConnection type objects |
|
| 225 | + * @throws \Route4Me\Exception\ApiError |
|
| 226 | + */ |
|
| 227 | + public function getTelematicsConnections($apiToken) |
|
| 228 | + { |
|
| 229 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 230 | 230 | |
| 231 | - $result = Route4Me::makeRequst([ |
|
| 232 | - 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 233 | - 'method' => 'GET', |
|
| 234 | - 'query' => [ |
|
| 235 | - 'api_token' => $apiToken |
|
| 236 | - ], |
|
| 237 | - ]); |
|
| 231 | + $result = Route4Me::makeRequst([ |
|
| 232 | + 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 233 | + 'method' => 'GET', |
|
| 234 | + 'query' => [ |
|
| 235 | + 'api_token' => $apiToken |
|
| 236 | + ], |
|
| 237 | + ]); |
|
| 238 | 238 | |
| 239 | - return $result; |
|
| 240 | - } |
|
| 239 | + return $result; |
|
| 240 | + } |
|
| 241 | 241 | |
| 242 | - /** |
|
| 243 | - * Get a telematics connection |
|
| 244 | - * @param $apiToken string : API token |
|
| 245 | - * @param $connectionToken string : connection token |
|
| 246 | - * @return array Array from a TelematicsConnection type object |
|
| 247 | - * @throws \Route4Me\Exception\ApiError |
|
| 248 | - */ |
|
| 249 | - public function getTelematicsConnection($apiToken, $connectionToken) |
|
| 250 | - { |
|
| 251 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 242 | + /** |
|
| 243 | + * Get a telematics connection |
|
| 244 | + * @param $apiToken string : API token |
|
| 245 | + * @param $connectionToken string : connection token |
|
| 246 | + * @return array Array from a TelematicsConnection type object |
|
| 247 | + * @throws \Route4Me\Exception\ApiError |
|
| 248 | + */ |
|
| 249 | + public function getTelematicsConnection($apiToken, $connectionToken) |
|
| 250 | + { |
|
| 251 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 252 | 252 | |
| 253 | - $result = Route4Me::makeRequst([ |
|
| 254 | - 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 255 | - 'method' => 'GET', |
|
| 256 | - 'query' => [ |
|
| 257 | - 'api_token' => $apiToken, |
|
| 258 | - 'connection_token' => $connectionToken |
|
| 259 | - ], |
|
| 260 | - ]); |
|
| 253 | + $result = Route4Me::makeRequst([ |
|
| 254 | + 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 255 | + 'method' => 'GET', |
|
| 256 | + 'query' => [ |
|
| 257 | + 'api_token' => $apiToken, |
|
| 258 | + 'connection_token' => $connectionToken |
|
| 259 | + ], |
|
| 260 | + ]); |
|
| 261 | 261 | |
| 262 | - return $result; |
|
| 263 | - } |
|
| 262 | + return $result; |
|
| 263 | + } |
|
| 264 | 264 | |
| 265 | - /** |
|
| 266 | - * Update telematics connection |
|
| 267 | - * @param $apiToken string : API token |
|
| 268 | - * @param $connectionToken string : connection token |
|
| 269 | - * @param $teleConParams TelematicsConnectionParameters : Telematics connection parameters |
|
| 270 | - * @return array Array from a TelematicsConnection type object |
|
| 271 | - * @throws \Route4Me\Exception\ApiError |
|
| 272 | - */ |
|
| 273 | - public function updateTelematicsConnection($apiToken, $connectionToken, $teleConParams) |
|
| 274 | - { |
|
| 275 | - $excludeFields = ['id', 'connection_token']; |
|
| 265 | + /** |
|
| 266 | + * Update telematics connection |
|
| 267 | + * @param $apiToken string : API token |
|
| 268 | + * @param $connectionToken string : connection token |
|
| 269 | + * @param $teleConParams TelematicsConnectionParameters : Telematics connection parameters |
|
| 270 | + * @return array Array from a TelematicsConnection type object |
|
| 271 | + * @throws \Route4Me\Exception\ApiError |
|
| 272 | + */ |
|
| 273 | + public function updateTelematicsConnection($apiToken, $connectionToken, $teleConParams) |
|
| 274 | + { |
|
| 275 | + $excludeFields = ['id', 'connection_token']; |
|
| 276 | 276 | |
| 277 | - $allBodyFields = Route4Me::getObjectProperties(new TelematicsConnectionParameters(), $excludeFields); |
|
| 277 | + $allBodyFields = Route4Me::getObjectProperties(new TelematicsConnectionParameters(), $excludeFields); |
|
| 278 | 278 | |
| 279 | - $result = Route4Me::makeRequst([ |
|
| 280 | - 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 281 | - 'method' => 'PUT', |
|
| 282 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $teleConParams), |
|
| 283 | - 'query' => ['api_token' => $apiToken, 'connection_token' => $connectionToken], |
|
| 284 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
| 285 | - ]); |
|
| 279 | + $result = Route4Me::makeRequst([ |
|
| 280 | + 'url' => Endpoint::TELEMATICS_CONNECTION, |
|
| 281 | + 'method' => 'PUT', |
|
| 282 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $teleConParams), |
|
| 283 | + 'query' => ['api_token' => $apiToken, 'connection_token' => $connectionToken], |
|
| 284 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data', |
|
| 285 | + ]); |
|
| 286 | 286 | |
| 287 | - return $result; |
|
| 288 | - } |
|
| 287 | + return $result; |
|
| 288 | + } |
|
| 289 | 289 | } |
@@ -9,66 +9,66 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class RouteAdvancedConstraints extends \Route4Me\Common |
| 11 | 11 | { |
| 12 | - /** Maximum cargo volume per route |
|
| 13 | - * @var double $max_cargo_volume |
|
| 14 | - */ |
|
| 15 | - public $max_cargo_volume; |
|
| 12 | + /** Maximum cargo volume per route |
|
| 13 | + * @var double $max_cargo_volume |
|
| 14 | + */ |
|
| 15 | + public $max_cargo_volume; |
|
| 16 | 16 | |
| 17 | - /** Vehicle capacity. |
|
| 18 | - * <para>How much total cargo can be transported per route (units, e.g. cubic meters)</para> |
|
| 19 | - * @var integer $max_capacity |
|
| 20 | - */ |
|
| 21 | - public $max_capacity; |
|
| 17 | + /** Vehicle capacity. |
|
| 18 | + * <para>How much total cargo can be transported per route (units, e.g. cubic meters)</para> |
|
| 19 | + * @var integer $max_capacity |
|
| 20 | + */ |
|
| 21 | + public $max_capacity; |
|
| 22 | 22 | |
| 23 | - /** Legacy feature which permits a user to request an example number of optimized routes. |
|
| 24 | - * @var integer $members_count |
|
| 25 | - */ |
|
| 26 | - public $members_count; |
|
| 23 | + /** Legacy feature which permits a user to request an example number of optimized routes. |
|
| 24 | + * @var integer $members_count |
|
| 25 | + */ |
|
| 26 | + public $members_count; |
|
| 27 | 27 | |
| 28 | - /** An array of the available time windows (e.g. [ [25200, 75000 ] ) |
|
| 29 | - * @var Array $available_time_windows |
|
| 30 | - */ |
|
| 31 | - public $available_time_windows; |
|
| 28 | + /** An array of the available time windows (e.g. [ [25200, 75000 ] ) |
|
| 29 | + * @var Array $available_time_windows |
|
| 30 | + */ |
|
| 31 | + public $available_time_windows; |
|
| 32 | 32 | |
| 33 | - /** The driver tags specified in a team member's custom data. |
|
| 34 | - * (e.g. "driver skills": |
|
| 35 | - * ["Class A CDL", "Class B CDL", "Forklift", "Skid Steer Loader", "Independent Contractor"] |
|
| 36 | - * @var string[] $tags |
|
| 37 | - */ |
|
| 38 | - public $tags; |
|
| 33 | + /** The driver tags specified in a team member's custom data. |
|
| 34 | + * (e.g. "driver skills": |
|
| 35 | + * ["Class A CDL", "Class B CDL", "Forklift", "Skid Steer Loader", "Independent Contractor"] |
|
| 36 | + * @var string[] $tags |
|
| 37 | + */ |
|
| 38 | + public $tags; |
|
| 39 | 39 | |
| 40 | - /** An array of the skilled driver IDs. |
|
| 41 | - * @var integer[] $route4me_members_id |
|
| 42 | - */ |
|
| 43 | - public $route4me_members_id; |
|
| 40 | + /** An array of the skilled driver IDs. |
|
| 41 | + * @var integer[] $route4me_members_id |
|
| 42 | + */ |
|
| 43 | + public $route4me_members_id; |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * A depot address. |
|
| 47 | - * @var Address |
|
| 48 | - */ |
|
| 49 | - public $depot_address; |
|
| 45 | + /** |
|
| 46 | + * A depot address. |
|
| 47 | + * @var Address |
|
| 48 | + */ |
|
| 49 | + public $depot_address; |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * An array of locations. |
|
| 53 | - * @var object[] |
|
| 54 | - */ |
|
| 55 | - public $location_sequence_pattern; |
|
| 51 | + /** |
|
| 52 | + * An array of locations. |
|
| 53 | + * @var object[] |
|
| 54 | + */ |
|
| 55 | + public $location_sequence_pattern; |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Group name of the advanced constraints. |
|
| 59 | - * @var string |
|
| 60 | - */ |
|
| 61 | - public $group; |
|
| 57 | + /** |
|
| 58 | + * Group name of the advanced constraints. |
|
| 59 | + * @var string |
|
| 60 | + */ |
|
| 61 | + public $group; |
|
| 62 | 62 | |
| 63 | - public static function fromArray(array $params) |
|
| 64 | - { |
|
| 65 | - $routeParams = new self(); |
|
| 66 | - foreach ($params as $key => $value) { |
|
| 67 | - if (property_exists($routeParams, $key)) { |
|
| 68 | - $routeParams->{$key} = $value; |
|
| 69 | - } |
|
| 70 | - } |
|
| 63 | + public static function fromArray(array $params) |
|
| 64 | + { |
|
| 65 | + $routeParams = new self(); |
|
| 66 | + foreach ($params as $key => $value) { |
|
| 67 | + if (property_exists($routeParams, $key)) { |
|
| 68 | + $routeParams->{$key} = $value; |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - return $routeParams; |
|
| 73 | - } |
|
| 72 | + return $routeParams; |
|
| 73 | + } |
|
| 74 | 74 | } |
@@ -23,25 +23,25 @@ discard block |
||
| 23 | 23 | //********************************************************************** |
| 24 | 24 | // General Route Parameters |
| 25 | 25 | $parameters = RouteParameters::fromArray([ |
| 26 | - 'rt' => false, |
|
| 27 | - 'algorithm_type' => Algorithmtype::ADVANCED_CVRP_TW, |
|
| 28 | - 'route_name' => 'Persistent Location - Single Depot - Multiple Driver '.date('Y-m-d H:i:s', time()), |
|
| 29 | - 'route_time' => 25200, |
|
| 30 | - 'distance_unit' => DistanceUnit::MILES, |
|
| 31 | - 'device_type' => DeviceType::WEB, |
|
| 32 | - 'optimize' => OptimizationType::DISTANCE, |
|
| 33 | - 'travel_mode' => TravelMode::DRIVING, |
|
| 34 | - 'advanced_constraints' => [] |
|
| 26 | + 'rt' => false, |
|
| 27 | + 'algorithm_type' => Algorithmtype::ADVANCED_CVRP_TW, |
|
| 28 | + 'route_name' => 'Persistent Location - Single Depot - Multiple Driver '.date('Y-m-d H:i:s', time()), |
|
| 29 | + 'route_time' => 25200, |
|
| 30 | + 'distance_unit' => DistanceUnit::MILES, |
|
| 31 | + 'device_type' => DeviceType::WEB, |
|
| 32 | + 'optimize' => OptimizationType::DISTANCE, |
|
| 33 | + 'travel_mode' => TravelMode::DRIVING, |
|
| 34 | + 'advanced_constraints' => [] |
|
| 35 | 35 | ]); |
| 36 | 36 | |
| 37 | 37 | //********************************************************************** |
| 38 | 38 | // Persistent Location |
| 39 | 39 | $persistent_location = [ |
| 40 | - 'alias' => 'DEPOT END LOCATION', |
|
| 41 | - 'address' => '4738 BELLEVUE AVE, Louisville, KY, 40215', |
|
| 42 | - 'lat' => 38.179806, |
|
| 43 | - 'lng' => -85.775558, |
|
| 44 | - 'time' => 300 |
|
| 40 | + 'alias' => 'DEPOT END LOCATION', |
|
| 41 | + 'address' => '4738 BELLEVUE AVE, Louisville, KY, 40215', |
|
| 42 | + 'lat' => 38.179806, |
|
| 43 | + 'lng' => -85.775558, |
|
| 44 | + 'time' => 300 |
|
| 45 | 45 | ]; |
| 46 | 46 | |
| 47 | 47 | //********************************************************************** |
@@ -50,22 +50,22 @@ discard block |
||
| 50 | 50 | // Time Window Start: 2:00 am EST |
| 51 | 51 | // Time Window End: 15:50 am EST |
| 52 | 52 | $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([ |
| 53 | - 'max_cargo_volume' => 0.0, |
|
| 54 | - 'max_capacity' => 200, |
|
| 55 | - 'members_count' => 10, |
|
| 56 | - 'available_time_windows' => [[25200, 75000]], |
|
| 57 | - 'location_sequence_pattern' => ['', $persistent_location] |
|
| 53 | + 'max_cargo_volume' => 0.0, |
|
| 54 | + 'max_capacity' => 200, |
|
| 55 | + 'members_count' => 10, |
|
| 56 | + 'available_time_windows' => [[25200, 75000]], |
|
| 57 | + 'location_sequence_pattern' => ['', $persistent_location] |
|
| 58 | 58 | ]); |
| 59 | 59 | |
| 60 | 60 | // Schedule 2 |
| 61 | 61 | // Time Window Start: 7:33 am EST |
| 62 | 62 | // Time Window End: 21:23 am EST |
| 63 | 63 | $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([ |
| 64 | - 'max_cargo_volume' => 0.0, |
|
| 65 | - 'max_capacity' => 200, |
|
| 66 | - 'members_count' => 10, |
|
| 67 | - 'available_time_windows' => [[45200, 95000]], |
|
| 68 | - 'location_sequence_pattern' => ['', $persistent_location] |
|
| 64 | + 'max_cargo_volume' => 0.0, |
|
| 65 | + 'max_capacity' => 200, |
|
| 66 | + 'members_count' => 10, |
|
| 67 | + 'available_time_windows' => [[45200, 95000]], |
|
| 68 | + 'location_sequence_pattern' => ['', $persistent_location] |
|
| 69 | 69 | ]); |
| 70 | 70 | |
| 71 | 71 | //********************************************************************** |
@@ -74,25 +74,25 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | // Depot |
| 76 | 76 | $addresses[] = Address::fromArray([ |
| 77 | - 'address' => '1604 PARKRIDGE PKWY, Louisville, KY, 40214', |
|
| 78 | - 'is_depot' => true, |
|
| 79 | - 'lat' => 38.141598, |
|
| 80 | - 'lng' => -85.793846, |
|
| 81 | - 'time' => 0 |
|
| 77 | + 'address' => '1604 PARKRIDGE PKWY, Louisville, KY, 40214', |
|
| 78 | + 'is_depot' => true, |
|
| 79 | + 'lat' => 38.141598, |
|
| 80 | + 'lng' => -85.793846, |
|
| 81 | + 'time' => 0 |
|
| 82 | 82 | ]); |
| 83 | 83 | |
| 84 | 84 | // Stops |
| 85 | 85 | foreach ($json as $address) { |
| 86 | 86 | |
| 87 | - // skip persistent |
|
| 88 | - if($address['address'] == '4738 BELLEVUE AVE, Louisville, KY, 40215') continue; |
|
| 87 | + // skip persistent |
|
| 88 | + if($address['address'] == '4738 BELLEVUE AVE, Louisville, KY, 40215') continue; |
|
| 89 | 89 | |
| 90 | - $addresses[] = Address::fromArray([ |
|
| 91 | - 'address' => $address['address'], |
|
| 92 | - 'lat' => $address['lat'], |
|
| 93 | - 'lng' => $address['lng'], |
|
| 94 | - 'time' => $address['time'] |
|
| 95 | - ]); |
|
| 90 | + $addresses[] = Address::fromArray([ |
|
| 91 | + 'address' => $address['address'], |
|
| 92 | + 'lat' => $address['lat'], |
|
| 93 | + 'lng' => $address['lng'], |
|
| 94 | + 'time' => $address['time'] |
|
| 95 | + ]); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $optimizationParams = new OptimizationProblemParams(); |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | echo "Routes:" . PHP_EOL; |
| 108 | 108 | foreach($problem->routes as $route) |
| 109 | 109 | { |
| 110 | - echo "\tID: " . $route->route_id . PHP_EOL; |
|
| 111 | - echo "\tDistance: " . $route->trip_distance . PHP_EOL; |
|
| 112 | - echo "\tAddresses:" . PHP_EOL; |
|
| 110 | + echo "\tID: " . $route->route_id . PHP_EOL; |
|
| 111 | + echo "\tDistance: " . $route->trip_distance . PHP_EOL; |
|
| 112 | + echo "\tAddresses:" . PHP_EOL; |
|
| 113 | 113 | |
| 114 | - foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL; |
|
| 114 | + foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL; |
|
| 115 | 115 | } |