@@ -294,7 +294,9 @@ |
||
294 | 294 | |
295 | 295 | public static function tearDownAfterClass() |
296 | 296 | { |
297 | - if (sizeof(self::$createdTerritories)<1) return; |
|
297 | + if (sizeof(self::$createdTerritories)<1) { |
|
298 | + return; |
|
299 | + } |
|
298 | 300 | |
299 | 301 | $territory = new Territory(); |
300 | 302 |
@@ -199,8 +199,7 @@ |
||
199 | 199 | |
200 | 200 | if ($result==true) { |
201 | 201 | echo "The test avoidance zone with territory_id=".$territoryId." removed. <br>"; |
202 | - } |
|
203 | - else { |
|
202 | + } else { |
|
204 | 203 | echo "Cannot remove the test avoidance zone with territory_id=".$territoryId."<br>"; |
205 | 204 | } |
206 | 205 |
@@ -383,7 +383,9 @@ |
||
383 | 383 | |
384 | 384 | public function testValidateScheduleNthWhat() |
385 | 385 | { |
386 | - for ($i=1;$i<11;$i++) $this->assertTrue(AddressBookLocation::validateScheduleNthWhat($i)); |
|
386 | + for ($i=1;$i<11;$i++) { |
|
387 | + $this->assertTrue(AddressBookLocation::validateScheduleNthWhat($i)); |
|
388 | + } |
|
387 | 389 | |
388 | 390 | $this->assertFalse(AddressBookLocation::validateScheduleNthWhat(0)); |
389 | 391 | $this->assertFalse(AddressBookLocation::validateScheduleNthWhat(14)); |
@@ -59,7 +59,9 @@ discard block |
||
59 | 59 | |
60 | 60 | assert(is_array($duplicateResult1), "Cannot duplicate the route<br>"); |
61 | 61 | |
62 | -if (!$duplicateResult1['status'] || sizeof($duplicateResult1['route_ids'])<1) die("Cannot duplicate the route<br>"); |
|
62 | +if (!$duplicateResult1['status'] || sizeof($duplicateResult1['route_ids'])<1) { |
|
63 | + die("Cannot duplicate the route<br>"); |
|
64 | +} |
|
63 | 65 | |
64 | 66 | $duplicatedRouteId1 = $duplicateResult1['route_ids'][0]; |
65 | 67 | |
@@ -95,7 +97,9 @@ discard block |
||
95 | 97 | |
96 | 98 | assert(is_array($duplicateResult2), "Cannot duplicate the route<br>"); |
97 | 99 | |
98 | -if (!$duplicateResult2['status'] || sizeof($duplicateResult2['route_ids'])<1) die("Cannot duplicate the route<br>"); |
|
100 | +if (!$duplicateResult2['status'] || sizeof($duplicateResult2['route_ids'])<1) { |
|
101 | + die("Cannot duplicate the route<br>"); |
|
102 | +} |
|
99 | 103 | |
100 | 104 | $duplicatedRouteId2 = $duplicateResult2['route_ids'][0]; |
101 | 105 |
@@ -582,70 +582,70 @@ |
||
582 | 582 | |
583 | 583 | if ('daily' != $mode) { |
584 | 584 | switch ($mode) { |
585 | - case 'weekly': |
|
586 | - if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
587 | - if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
588 | - $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}'; |
|
589 | - } else { |
|
590 | - array_push($results['fail'], "$iRow --> Wrong weekdays"); |
|
591 | - } |
|
585 | + case 'weekly': |
|
586 | + if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
587 | + if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
588 | + $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}'; |
|
589 | + } else { |
|
590 | + array_push($results['fail'], "$iRow --> Wrong weekdays"); |
|
591 | + } |
|
592 | + } else { |
|
593 | + array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); |
|
594 | + } |
|
595 | + break; |
|
596 | + case 'monthly': |
|
597 | + $monthlyMode = ''; |
|
598 | + if (isset($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
599 | + if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
600 | + $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']]; |
|
601 | + $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",'; |
|
592 | 602 | } else { |
593 | - array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); |
|
603 | + array_push($results['fail'], "$iRow --> Wrong monthly mode"); |
|
604 | + } |
|
605 | + } else { |
|
606 | + array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); |
|
607 | + } |
|
608 | + |
|
609 | + if ('' != $monthlyMode) { |
|
610 | + switch ($monthlyMode) { |
|
611 | + case 'dates': |
|
612 | + if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
613 | + if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
614 | + $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}'; |
|
615 | + } else { |
|
616 | + array_push($results['fail'], "$iRow --> Wrong monthly dates"); |
|
617 | + } |
|
594 | 618 | } |
595 | 619 | break; |
596 | - case 'monthly': |
|
597 | - $monthlyMode = ''; |
|
598 | - if (isset($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
599 | - if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
600 | - $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']]; |
|
601 | - $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",'; |
|
602 | - } else { |
|
603 | - array_push($results['fail'], "$iRow --> Wrong monthly mode"); |
|
604 | - } |
|
620 | + case 'nth': |
|
621 | + if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
622 | + if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
623 | + $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].','; |
|
605 | 624 | } else { |
606 | - array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); |
|
625 | + array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); |
|
626 | + } |
|
627 | + } else { |
|
628 | + array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); |
|
607 | 629 | } |
608 | 630 | |
609 | - if ('' != $monthlyMode) { |
|
610 | - switch ($monthlyMode) { |
|
611 | - case 'dates': |
|
612 | - if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
613 | - if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
614 | - $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}'; |
|
615 | - } else { |
|
616 | - array_push($results['fail'], "$iRow --> Wrong monthly dates"); |
|
617 | - } |
|
618 | - } |
|
619 | - break; |
|
620 | - case 'nth': |
|
621 | - if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
622 | - if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
623 | - $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].','; |
|
624 | - } else { |
|
625 | - array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); |
|
626 | - } |
|
627 | - } else { |
|
628 | - array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); |
|
629 | - } |
|
630 | - |
|
631 | - if ('' != $curSchedule) { |
|
632 | - if (isset($rows[$locationsFieldsMapping['monthly_nth_what']])) { |
|
633 | - if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_what']])) { |
|
634 | - $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_what']].'}}'; |
|
635 | - } else { |
|
636 | - array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); |
|
637 | - } |
|
638 | - } else { |
|
639 | - array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); |
|
640 | - } |
|
641 | - } |
|
642 | - break; |
|
631 | + if ('' != $curSchedule) { |
|
632 | + if (isset($rows[$locationsFieldsMapping['monthly_nth_what']])) { |
|
633 | + if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_what']])) { |
|
634 | + $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_what']].'}}'; |
|
635 | + } else { |
|
636 | + array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); |
|
643 | 637 | } |
638 | + } else { |
|
639 | + array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); |
|
640 | + } |
|
644 | 641 | } |
645 | 642 | break; |
646 | - default: |
|
647 | - $curSchedule = ''; |
|
643 | + } |
|
644 | + } |
|
648 | 645 | break; |
646 | + default: |
|
647 | + $curSchedule = ''; |
|
648 | + break; |
|
649 | 649 | } |
650 | 650 | } |
651 | 651 |
@@ -390,8 +390,12 @@ discard block |
||
390 | 390 | public static function validateScheduleEnable($scheduleEnabled) |
391 | 391 | { |
392 | 392 | if (is_string($scheduleEnabled)) { |
393 | - if (strtolower($scheduleEnabled)=="true") $scheduleEnabled = true; |
|
394 | - if (strtolower($scheduleEnabled)=="false") $scheduleEnabled = false; |
|
393 | + if (strtolower($scheduleEnabled)=="true") { |
|
394 | + $scheduleEnabled = true; |
|
395 | + } |
|
396 | + if (strtolower($scheduleEnabled)=="false") { |
|
397 | + $scheduleEnabled = false; |
|
398 | + } |
|
395 | 399 | } |
396 | 400 | |
397 | 401 | $schedEnables = [true, false,]; |
@@ -418,7 +422,9 @@ discard block |
||
418 | 422 | |
419 | 423 | public static function validateScheduleWeekDays($scheduleWeekDays) |
420 | 424 | { |
421 | - if (is_bool($scheduleWeekDays)) return false; |
|
425 | + if (is_bool($scheduleWeekDays)) { |
|
426 | + return false; |
|
427 | + } |
|
422 | 428 | |
423 | 429 | $weekdays = explode(',', $scheduleWeekDays); |
424 | 430 | $weekdaysSize = sizeof($weekdays); |
@@ -458,7 +464,9 @@ discard block |
||
458 | 464 | |
459 | 465 | public static function validateScheduleMonthlyDates($scheduleMonthlyDates) |
460 | 466 | { |
461 | - if (is_bool($scheduleMonthlyDates)) return false; |
|
467 | + if (is_bool($scheduleMonthlyDates)) { |
|
468 | + return false; |
|
469 | + } |
|
462 | 470 | |
463 | 471 | $monthlyDates = explode(',', $scheduleMonthlyDates); |
464 | 472 | $monthlyDatesSize = sizeof($monthlyDates); |
@@ -178,7 +178,9 @@ |
||
178 | 178 | 'method' => 'GET', |
179 | 179 | ]); |
180 | 180 | |
181 | - if (is_null($result) || !is_array($result)) return null; |
|
181 | + if (is_null($result) || !is_array($result)) { |
|
182 | + return null; |
|
183 | + } |
|
182 | 184 | |
183 | 185 | foreach ($result as $custNoteType) { |
184 | 186 | if (isset($custNoteType["note_custom_type"]) && $custNoteType["note_custom_type"] == $params) { |
@@ -209,16 +209,16 @@ |
||
209 | 209 | |
210 | 210 | foreach ($device->Attributes as $attr) { |
211 | 211 | switch ($attr->AttributeDisplayName) { |
212 | - case 'desc': |
|
213 | - $this->_doorName = $attr->Value; |
|
214 | - break; |
|
215 | - case 'doorstate': |
|
216 | - $this->_doorState = $attr->Value; |
|
217 | - // UpdatedTime is a timestamp in ms, so we truncate |
|
218 | - $this->_doorStateTime = (int) $attr->UpdatedTime / 1000; |
|
219 | - break; |
|
220 | - default: |
|
221 | - continue; |
|
212 | + case 'desc': |
|
213 | + $this->_doorName = $attr->Value; |
|
214 | + break; |
|
215 | + case 'doorstate': |
|
216 | + $this->_doorState = $attr->Value; |
|
217 | + // UpdatedTime is a timestamp in ms, so we truncate |
|
218 | + $this->_doorStateTime = (int) $attr->UpdatedTime / 1000; |
|
219 | + break; |
|
220 | + default: |
|
221 | + continue; |
|
222 | 222 | } |
223 | 223 | } |
224 | 224 | } |
@@ -83,7 +83,9 @@ |
||
83 | 83 | $vehiclesResponse = new self(); |
84 | 84 | |
85 | 85 | foreach ($params as $key => $value) { |
86 | - if (is_null(Common::getValue($params, $key))) continue; |
|
86 | + if (is_null(Common::getValue($params, $key))) { |
|
87 | + continue; |
|
88 | + } |
|
87 | 89 | if (property_exists($vehiclesResponse, $key)) { |
88 | 90 | $vehiclesResponse->$key = $value; |
89 | 91 | } |
@@ -137,7 +137,9 @@ |
||
137 | 137 | $vehicleCreateResponse = new self(); |
138 | 138 | |
139 | 139 | foreach ($params as $key => $value) { |
140 | - if (is_null(Common::getValue($params, $key))) continue; |
|
140 | + if (is_null(Common::getValue($params, $key))) { |
|
141 | + continue; |
|
142 | + } |
|
141 | 143 | if (property_exists($vehicleCreateResponse, $key)) { |
142 | 144 | $vehicleCreateResponse->$key = $value; |
143 | 145 | } |