@@ -1,7 +1,7 @@ |
||
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; |
@@ -1,7 +1,7 @@ |
||
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; |
@@ -1,7 +1,7 @@ |
||
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; |
@@ -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 | )); |
@@ -19,7 +19,7 @@ |
||
19 | 19 | { |
20 | 20 | $geocoding = new Geocoding(); |
21 | 21 | |
22 | - foreach($params as $key => $value) { |
|
22 | + foreach ($params as $key => $value) { |
|
23 | 23 | if (property_exists($geocoding, $key)) { |
24 | 24 | $geocoding->{$key} = $value; |
25 | 25 | } |
@@ -171,7 +171,7 @@ |
||
171 | 171 | |
172 | 172 | public function mergeRoutes($params) |
173 | 173 | { |
174 | - $allBodyFields = array('route_ids', 'depot_address', 'remove_origin', 'depot_lat', 'depot_lng'); |
|
174 | + $allBodyFields = array('route_ids', 'depot_address', 'remove_origin', 'depot_lat', 'depot_lng'); |
|
175 | 175 | |
176 | 176 | $result = Route4Me::makeRequst(array( |
177 | 177 | 'url' => Endpoint::ROUTES_MERGE, |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | |
66 | 66 | public static function fromArray(array $params) |
67 | 67 | { |
68 | - $member= new Member(); |
|
68 | + $member = new Member(); |
|
69 | 69 | |
70 | - foreach($params as $key => $value) { |
|
70 | + foreach ($params as $key => $value) { |
|
71 | 71 | if (property_exists($member, $key)) { |
72 | 72 | $member->{$key} = $value; |
73 | 73 | } |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | |
155 | 155 | foreach ($members['results'] as $memb) { |
156 | 156 | if (isset($memb['member_id']) && isset($memb['member_type'])) { |
157 | - if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id']; |
|
157 | + if ($memberType==$memb['member_type']) $memberIDs[] = $memb['member_id']; |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
161 | 161 | if (sizeof($memberIDs)<1) return null; |
162 | 162 | |
163 | - $randomIndex = rand(0, sizeof($memberIDs)-1); |
|
163 | + $randomIndex = rand(0, sizeof($memberIDs) - 1); |
|
164 | 164 | |
165 | 165 | return $memberIDs[$randomIndex]; |
166 | 166 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | $isValid = TRUE; |
216 | 216 | |
217 | - for ($i=0; $i<sizeof($weekdays); $i++) { |
|
217 | + for ($i = 0; $i<sizeof($weekdays); $i++) { |
|
218 | 218 | if (is_numeric($weekdays[$i])) { |
219 | 219 | $wday = intval($weekdays[$i]); |
220 | 220 | if ($wday<1 || $wday>7) $isValid = FALSE; |
@@ -241,14 +241,14 @@ discard block |
||
241 | 241 | { |
242 | 242 | $monthlyDates = explode(',', $scheduleMonthlyDates); |
243 | 243 | |
244 | - if (sizeof($monthlyDates) <1) return FALSE; |
|
244 | + if (sizeof($monthlyDates)<1) return FALSE; |
|
245 | 245 | |
246 | 246 | $isValid = TRUE; |
247 | 247 | |
248 | - for ($i=0; $i < sizeof($monthlyDates); $i++) { |
|
248 | + for ($i = 0; $i<sizeof($monthlyDates); $i++) { |
|
249 | 249 | if (is_numeric($monthlyDates[$i])) { |
250 | 250 | $mday = intval($monthlyDates[$i]); |
251 | - if ($mday <1 || $mday > 31) $isValid = FALSE; |
|
251 | + if ($mday<1 || $mday>31) $isValid = FALSE; |
|
252 | 252 | } else { |
253 | 253 | $isValid = FALSE; |
254 | 254 | } |
@@ -339,10 +339,10 @@ discard block |
||
339 | 339 | |
340 | 340 | if (isset($rows[$locationsFieldsMapping['schedule_every']])) { |
341 | 341 | if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) { |
342 | - $curSchedule.='"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; |
|
342 | + $curSchedule .= '"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; |
|
343 | 343 | if ($mode=='daily') { |
344 | - $curSchedule = trim($curSchedule,','); |
|
345 | - $curSchedule.='}'; |
|
344 | + $curSchedule = trim($curSchedule, ','); |
|
345 | + $curSchedule .= '}'; |
|
346 | 346 | } |
347 | 347 | } else { |
348 | 348 | array_push($results['fail'], "$iRow --> The parameter sched_every is not set"); |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | |
432 | 432 | $curSchedule = '[{'.$curSchedule.'}]'; |
433 | 433 | |
434 | - $oSchedule = json_decode($curSchedule,TRUE); |
|
434 | + $oSchedule = json_decode($curSchedule, TRUE); |
|
435 | 435 | |
436 | 436 | $parametersArray = array(); |
437 | 437 |