@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root = realpath(dirname(__FILE__) . '/../../'); |
|
| 5 | -require $root . '/vendor/autoload.php'; |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | +require $root.'/vendor/autoload.php'; |
|
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
| 8 | 8 | |
@@ -22,6 +22,6 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | $abcResult = $ablocation->searchAddressBookLocations($params); |
| 24 | 24 | |
| 25 | -$results = $ablocation->getValue($abcResult,"results"); |
|
| 25 | +$results = $ablocation->getValue($abcResult, "results"); |
|
| 26 | 26 | |
| 27 | 27 | Route4Me::simplePrint($results); |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root=realpath(dirname(__FILE__).'/../../'); |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | 5 | require $root.'/vendor/autoload.php'; |
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | assert(!is_null($randomOrder), "Can't retrieve a random order"); |
| 25 | 25 | |
| 26 | 26 | // Update the order |
| 27 | -$randomOrder['address_2']="Lviv"; |
|
| 28 | -$randomOrder['EXT_FIELD_phone']="032268593"; |
|
| 27 | +$randomOrder['address_2'] = "Lviv"; |
|
| 28 | +$randomOrder['EXT_FIELD_phone'] = "032268593"; |
|
| 29 | 29 | $randomOrder['EXT_FIELD_custom_data'] = array( |
| 30 | 30 | 0 => array( |
| 31 | 31 | "customer_no" => "11" |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | Route4Me::setApiKey('11111111111111111111111111111111'); |
| 15 | 15 | |
| 16 | 16 | $orderParameters = Order::fromArray(array( |
| 17 | - "scheduled_for_YYMMDD" => date("Y-m-d", strtotime( '-1 days' )), |
|
| 17 | + "scheduled_for_YYMMDD" => date("Y-m-d", strtotime('-1 days')), |
|
| 18 | 18 | "offset" => 0, |
| 19 | 19 | "limit" => 5 |
| 20 | 20 | )); |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | Route4Me::setApiKey('11111111111111111111111111111111'); |
| 15 | 15 | |
| 16 | 16 | $orderParameters = Order::fromArray(array( |
| 17 | - "day_added_YYMMDD" => date("Y-m-d", strtotime( '-1 days' )), |
|
| 17 | + "day_added_YYMMDD" => date("Y-m-d", strtotime('-1 days')), |
|
| 18 | 18 | "offset" => 0, |
| 19 | 19 | "limit" => 5 |
| 20 | 20 | )); |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root=realpath(dirname(__FILE__).'/../'); |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../'); |
|
| 5 | 5 | require $root.'/vendor/autoload.php'; |
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | $route = new Route(); |
| 16 | 16 | |
| 17 | 17 | // Get a random route ID |
| 18 | -$route_id=$route->getRandomRouteId(0, 10); |
|
| 18 | +$route_id = $route->getRandomRouteId(0, 10); |
|
| 19 | 19 | assert(!is_null($route_id), "Can't retrieve a random route ID"); |
| 20 | 20 | |
| 21 | 21 | $params = array( |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root=realpath(dirname(__FILE__).'/../../'); |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | 5 | require $root.'/vendor/autoload.php'; |
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $results = (array)$routeResult; |
| 26 | 26 | |
| 27 | - if (isset($results['route_id'])) echo "Route ID - > " . $results['route_id'] . "<br>"; |
|
| 27 | + if (isset($results['route_id'])) echo "Route ID - > ".$results['route_id']."<br>"; |
|
| 28 | 28 | |
| 29 | - if (isset($results['parameters']->route_name)) echo "Route name - > " . $results['parameters']->route_name . "<br>"; |
|
| 29 | + if (isset($results['parameters']->route_name)) echo "Route name - > ".$results['parameters']->route_name."<br>"; |
|
| 30 | 30 | |
| 31 | 31 | echo "<br>"; |
| 32 | 32 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root=realpath(dirname(__FILE__).'/../../'); |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | 5 | require $root.'/vendor/autoload.php'; |
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | echo "Random route ID 1 -> $randomRouteID1 <br> Random route ID 2 -> $randomRouteID2 <br>"; |
| 26 | 26 | |
| 27 | 27 | // Remove selected routes |
| 28 | -$route_ids = join(',',array($randomRouteID1,$randomRouteID2)); |
|
| 28 | +$route_ids = join(',', array($randomRouteID1, $randomRouteID2)); |
|
| 29 | 29 | |
| 30 | 30 | $result = $route->deleteRoutes($route_ids); |
| 31 | 31 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | public static function searchOrder($params) |
| 217 | 217 | { |
| 218 | - $allQueryFields = array('fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit' ); |
|
| 218 | + $allQueryFields = array('fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit'); |
|
| 219 | 219 | |
| 220 | 220 | $response = Route4Me::makeRequst(array( |
| 221 | 221 | 'url' => Endpoint::ORDER_V4, |
@@ -269,11 +269,11 @@ discard block |
||
| 269 | 269 | $allOrderFields = Route4Me::getObjectProperties(new Order(), $excludeFields); |
| 270 | 270 | |
| 271 | 271 | if (!empty($columns)) { |
| 272 | - array_push($results['fail'],'Empty CSV table'); |
|
| 272 | + array_push($results['fail'], 'Empty CSV table'); |
|
| 273 | 273 | return ($results); |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - $iRow=1; |
|
| 276 | + $iRow = 1; |
|
| 277 | 277 | |
| 278 | 278 | while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) { |
| 279 | 279 | if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && array(null)!==$rows) { |
@@ -59,14 +59,14 @@ discard block |
||
| 59 | 59 | public $weight_metric; |
| 60 | 60 | public $max_weight_per_axle_group_metric; |
| 61 | 61 | |
| 62 | - public function __construct () |
|
| 62 | + public function __construct() |
|
| 63 | 63 | { |
| 64 | 64 | Route4Me::setBaseUrl(Endpoint::WH_BASE_URL); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | public static function fromArray(array $params) { |
| 68 | - $vehicle= new Vehicle(); |
|
| 69 | - foreach($params as $key => $value) { |
|
| 68 | + $vehicle = new Vehicle(); |
|
| 69 | + foreach ($params as $key => $value) { |
|
| 70 | 70 | if (property_exists($vehicle, $key)) { |
| 71 | 71 | $vehicle->{$key} = $value; |
| 72 | 72 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | return $response; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public function getRandomVehicleId($page,$perPage) |
|
| 91 | + public function getRandomVehicleId($page, $perPage) |
|
| 92 | 92 | { |
| 93 | 93 | $params = array( |
| 94 | 94 | 'page' => isset($page) ? $page : 1, |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | if (!isset($vehicles['data'])) return null; |
| 103 | 103 | if (sizeof($vehicles['data'])<1) return null; |
| 104 | 104 | |
| 105 | - $randomIndex = rand(0, sizeof($vehicles['data'])-1); |
|
| 105 | + $randomIndex = rand(0, sizeof($vehicles['data']) - 1); |
|
| 106 | 106 | |
| 107 | 107 | return $vehicles['data'][$randomIndex]['vehicle_id']; |
| 108 | 108 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | public function getVehicleByID($vehicleID) |
| 111 | 111 | { |
| 112 | 112 | $response = Route4Me::makeRequst(array( |
| 113 | - 'url' => Endpoint::VEHICLE_V4 . '/' . $vehicleID, |
|
| 113 | + 'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID, |
|
| 114 | 114 | 'method' => 'GET' |
| 115 | 115 | )); |
| 116 | 116 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $allBodyFields = Route4Me::getObjectProperties(new Vehicle(), array('vehicle_id')); |
| 125 | 125 | |
| 126 | 126 | $response = Route4Me::makeRequst(array( |
| 127 | - 'url' => Endpoint::VEHICLE_V4 . '/' . $vehicleID, |
|
| 127 | + 'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID, |
|
| 128 | 128 | 'method' => 'PUT', |
| 129 | 129 | 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
| 130 | 130 | 'HTTPHEADER' => 'Content-Type: application/json' |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null; |
| 153 | 153 | |
| 154 | 154 | $response = Route4Me::makeRequst(array( |
| 155 | - 'url' => Endpoint::VEHICLE_V4 . '/' . $vehicleID, |
|
| 155 | + 'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID, |
|
| 156 | 156 | 'method' => 'DELETE', |
| 157 | 157 | 'HTTPHEADER' => 'Content-Type: application/json' |
| 158 | 158 | )); |