@@ -163,18 +163,26 @@ |
||
| 163 | 163 | { |
| 164 | 164 | $members = self::getUsers(); |
| 165 | 165 | |
| 166 | - if (is_null($members)) return null; |
|
| 167 | - if (!isset($members['results'])) return null; |
|
| 166 | + if (is_null($members)) { |
|
| 167 | + return null; |
|
| 168 | + } |
|
| 169 | + if (!isset($members['results'])) { |
|
| 170 | + return null; |
|
| 171 | + } |
|
| 168 | 172 | |
| 169 | 173 | $memberIDs = array(); |
| 170 | 174 | |
| 171 | 175 | foreach ($members['results'] as $memb) { |
| 172 | 176 | if (isset($memb['member_id']) && isset($memb['member_type'])) { |
| 173 | - if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id']; |
|
| 177 | + if ($memberType==$memb['member_type']) { |
|
| 178 | + $memberIDs[]=$memb['member_id']; |
|
| 179 | + } |
|
| 174 | 180 | } |
| 175 | 181 | } |
| 176 | 182 | |
| 177 | - if (sizeof($memberIDs)<1) return null; |
|
| 183 | + if (sizeof($memberIDs)<1) { |
|
| 184 | + return null; |
|
| 185 | + } |
|
| 178 | 186 | |
| 179 | 187 | $randomIndex = rand(0, sizeof($memberIDs)-1); |
| 180 | 188 | |
@@ -24,8 +24,7 @@ |
||
| 24 | 24 | if (is_array($value)) |
| 25 | 25 | { |
| 26 | 26 | Route4Me::simplePrint($value); |
| 27 | - } |
|
| 28 | - else |
|
| 27 | + } else |
|
| 29 | 28 | { |
| 30 | 29 | echo "$key => $value <br>"; |
| 31 | 30 | } |
@@ -32,7 +32,9 @@ |
||
| 32 | 32 | foreach ($routeResults['addresses'] as $key => $address) { |
| 33 | 33 | $araddress = (array)$address; |
| 34 | 34 | |
| 35 | - if (isset($araddress['route_destination_id'])) echo "route_destination_id=".$araddress['route_destination_id']."<br>"; |
|
| 35 | + if (isset($araddress['route_destination_id'])) { |
|
| 36 | + echo "route_destination_id=".$araddress['route_destination_id']."<br>"; |
|
| 37 | + } |
|
| 36 | 38 | |
| 37 | 39 | if (isset($araddress['path_to_next'])) { |
| 38 | 40 | echo "path_to_next:<br>"; |
@@ -86,7 +86,9 @@ discard block |
||
| 86 | 86 | 'is_completed', 'custom_user_fields'); |
| 87 | 87 | |
| 88 | 88 | foreach ($allAddOrderParameters as $addOrderParameter) { |
| 89 | - if (isset($params->{$addOrderParameter})) $body[$addOrderParameter] = $params->{$addOrderParameter}; |
|
| 89 | + if (isset($params->{$addOrderParameter})) { |
|
| 90 | + $body[$addOrderParameter] = $params->{$addOrderParameter}; |
|
| 91 | + } |
|
| 90 | 92 | } |
| 91 | 93 | |
| 92 | 94 | $response = Route4Me::makeRequst(array( |
@@ -135,7 +137,9 @@ discard block |
||
| 135 | 137 | $allGetParameters = array('order_id', 'fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit' ); |
| 136 | 138 | |
| 137 | 139 | foreach ($allGetParameters as $getParameter) { |
| 138 | - if (isset($params->{$getParameter})) $query[$getParameter] = $params->{$getParameter}; |
|
| 140 | + if (isset($params->{$getParameter})) { |
|
| 141 | + $query[$getParameter] = $params->{$getParameter}; |
|
| 142 | + } |
|
| 139 | 143 | } |
| 140 | 144 | |
| 141 | 145 | $response = Route4Me::makeRequst(array( |
@@ -233,7 +237,9 @@ discard block |
||
| 233 | 237 | $allSearchParameters = array('fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit' ); |
| 234 | 238 | |
| 235 | 239 | foreach ($allSearchParameters as $searchParameter) { |
| 236 | - if (isset($params->{$searchParameter})) $query[$searchParameter] = $params->{$searchParameter}; |
|
| 240 | + if (isset($params->{$searchParameter})) { |
|
| 241 | + $query[$searchParameter] = $params->{$searchParameter}; |
|
| 242 | + } |
|
| 237 | 243 | } |
| 238 | 244 | |
| 239 | 245 | $response = Route4Me::makeRequst(array( |
@@ -372,8 +378,7 @@ discard block |
||
| 372 | 378 | $orderResults = $order->addOrder($orderParameters); |
| 373 | 379 | |
| 374 | 380 | array_push($results['success'], "The order with order_id = ".strval($orderResults["order_id"])." added successfuly."); |
| 375 | - } |
|
| 376 | - else { |
|
| 381 | + } else { |
|
| 377 | 382 | array_push($results['fail'], "$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); |
| 378 | 383 | } |
| 379 | 384 | |
@@ -71,8 +71,12 @@ |
||
| 71 | 71 | { |
| 72 | 72 | $terParams = array(); |
| 73 | 73 | |
| 74 | - if (isset($params->territory['type'])) $terParams['type'] = $params->territory['type']; |
|
| 75 | - if (isset($params->territory['data'])) $terParams['data'] = $params->territory['data']; |
|
| 74 | + if (isset($params->territory['type'])) { |
|
| 75 | + $terParams['type'] = $params->territory['type']; |
|
| 76 | + } |
|
| 77 | + if (isset($params->territory['data'])) { |
|
| 78 | + $terParams['data'] = $params->territory['data']; |
|
| 79 | + } |
|
| 76 | 80 | |
| 77 | 81 | $response = Route4Me::makeRequst(array( |
| 78 | 82 | 'url' => Endpoint::TERRITORY_V4, |
@@ -198,7 +198,7 @@ |
||
| 198 | 198 | } else { |
| 199 | 199 | return $json; |
| 200 | 200 | } |
| 201 | - } elseif (409==$code) { |
|
| 201 | + } elseif (409==$code) { |
|
| 202 | 202 | throw new ApiError('Wrong API key'); |
| 203 | 203 | } else { |
| 204 | 204 | throw new ApiError('Something wrong'); |
@@ -258,14 +258,18 @@ discard block |
||
| 258 | 258 | { |
| 259 | 259 | $weekdays = explode(',', $scheduleWeekDays); |
| 260 | 260 | |
| 261 | - if (sizeof($weekdays)<1) return FALSE; |
|
| 261 | + if (sizeof($weekdays)<1) { |
|
| 262 | + return FALSE; |
|
| 263 | + } |
|
| 262 | 264 | |
| 263 | 265 | $isValid = TRUE; |
| 264 | 266 | |
| 265 | 267 | for ($i=0; $i<sizeof($weekdays); $i++) { |
| 266 | 268 | if (is_numeric($weekdays[$i])) { |
| 267 | 269 | $wday = intval($weekdays[$i]); |
| 268 | - if ($wday<1 || $wday>7) $isValid = FALSE; |
|
| 270 | + if ($wday<1 || $wday>7) { |
|
| 271 | + $isValid = FALSE; |
|
| 272 | + } |
|
| 269 | 273 | } else { |
| 270 | 274 | $isValid = FALSE; |
| 271 | 275 | } |
@@ -289,14 +293,18 @@ discard block |
||
| 289 | 293 | { |
| 290 | 294 | $monthlyDates = explode(',', $scheduleMonthlyDates); |
| 291 | 295 | |
| 292 | - if (sizeof($monthlyDates) <1) return FALSE; |
|
| 296 | + if (sizeof($monthlyDates) <1) { |
|
| 297 | + return FALSE; |
|
| 298 | + } |
|
| 293 | 299 | |
| 294 | 300 | $isValid = TRUE; |
| 295 | 301 | |
| 296 | 302 | for ($i=0; $i < sizeof($monthlyDates); $i++) { |
| 297 | 303 | if (is_numeric($monthlyDates[$i])) { |
| 298 | 304 | $mday = intval($monthlyDates[$i]); |
| 299 | - if ($mday <1 || $mday > 31) $isValid = FALSE; |
|
| 305 | + if ($mday <1 || $mday > 31) { |
|
| 306 | + $isValid = FALSE; |
|
| 307 | + } |
|
| 300 | 308 | } else { |
| 301 | 309 | $isValid = FALSE; |
| 302 | 310 | } |
@@ -307,7 +315,9 @@ discard block |
||
| 307 | 315 | |
| 308 | 316 | public static function validateScheduleNthN($scheduleNthN) |
| 309 | 317 | { |
| 310 | - if (!is_numeric($scheduleNthN)) return FALSE; |
|
| 318 | + if (!is_numeric($scheduleNthN)) { |
|
| 319 | + return FALSE; |
|
| 320 | + } |
|
| 311 | 321 | |
| 312 | 322 | $schedNthNs = array(1, 2, 3, 4, 5, -1); |
| 313 | 323 | |
@@ -320,7 +330,9 @@ discard block |
||
| 320 | 330 | |
| 321 | 331 | public static function validateScheduleNthWhat($scheduleNthWhat) |
| 322 | 332 | { |
| 323 | - if (!is_numeric($scheduleNthWhat)) return FALSE; |
|
| 333 | + if (!is_numeric($scheduleNthWhat)) { |
|
| 334 | + return FALSE; |
|
| 335 | + } |
|
| 324 | 336 | |
| 325 | 337 | $schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); |
| 326 | 338 | |
@@ -70,8 +70,12 @@ |
||
| 70 | 70 | { |
| 71 | 71 | $terParams = array(); |
| 72 | 72 | |
| 73 | - if (isset($params->territory['type'])) $terParams['type'] = $params->territory['type']; |
|
| 74 | - if (isset($params->territory['data'])) $terParams['data'] = $params->territory['data']; |
|
| 73 | + if (isset($params->territory['type'])) { |
|
| 74 | + $terParams['type'] = $params->territory['type']; |
|
| 75 | + } |
|
| 76 | + if (isset($params->territory['data'])) { |
|
| 77 | + $terParams['data'] = $params->territory['data']; |
|
| 78 | + } |
|
| 75 | 79 | |
| 76 | 80 | $abContacts = Route4Me::makeRequst(array( |
| 77 | 81 | 'url' => Endpoint::AVOIDANCE_ZONE, |