@@ -19,7 +19,7 @@ |
||
| 19 | 19 | * - If Mode=3, contains an array of the field names of the Address object; |
| 20 | 20 | * - If Mode=4, contains an array of the custom fields of the Address object. |
| 21 | 21 | */ |
| 22 | - public $mode_params= []; |
|
| 22 | + public $mode_params = []; |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * Address bundling merge mode |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | if (isset($ablocations['results'])) { |
| 325 | 325 | $locationsSize = sizeof($ablocations['results']); |
| 326 | 326 | |
| 327 | - if ($locationsSize > 0) { |
|
| 327 | + if ($locationsSize>0) { |
|
| 328 | 328 | $randomLocationIndex = rand(0, $locationsSize - 1); |
| 329 | 329 | |
| 330 | 330 | return $ablocations['results'][$randomLocationIndex]; |
@@ -394,9 +394,9 @@ discard block |
||
| 394 | 394 | if (strtolower($scheduleEnabled)=="false") $scheduleEnabled = false; |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - $schedEnables = [true, false,]; |
|
| 397 | + $schedEnables = [true, false, ]; |
|
| 398 | 398 | |
| 399 | - if (in_array($scheduleEnabled, $schedEnables,true)) { |
|
| 399 | + if (in_array($scheduleEnabled, $schedEnables, true)) { |
|
| 400 | 400 | return true; |
| 401 | 401 | } else { |
| 402 | 402 | return false; |
@@ -423,18 +423,18 @@ discard block |
||
| 423 | 423 | $weekdays = explode(',', $scheduleWeekDays); |
| 424 | 424 | $weekdaysSize = sizeof($weekdays); |
| 425 | 425 | |
| 426 | - if ($weekdaysSize < 1) { |
|
| 426 | + if ($weekdaysSize<1) { |
|
| 427 | 427 | return false; |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | $isValid = true; |
| 431 | 431 | |
| 432 | - for ($i = 0; $i < $weekdaysSize; ++$i) { |
|
| 432 | + for ($i = 0; $i<$weekdaysSize; ++$i) { |
|
| 433 | 433 | if (is_bool($weekdays[$i])) { |
| 434 | 434 | $isValid = false; |
| 435 | 435 | } elseif (is_numeric($weekdays[$i])) { |
| 436 | 436 | $wday = intval($weekdays[$i]); |
| 437 | - if ($wday < 1 || $wday > 7) { |
|
| 437 | + if ($wday<1 || $wday>7) { |
|
| 438 | 438 | $isValid = false; |
| 439 | 439 | } |
| 440 | 440 | } else { |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | { |
| 450 | 450 | $schedMonthlyMmodes = ['dates', 'nth']; |
| 451 | 451 | |
| 452 | - if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes,true)) { |
|
| 452 | + if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes, true)) { |
|
| 453 | 453 | return true; |
| 454 | 454 | } else { |
| 455 | 455 | return false; |
@@ -463,16 +463,16 @@ discard block |
||
| 463 | 463 | $monthlyDates = explode(',', $scheduleMonthlyDates); |
| 464 | 464 | $monthlyDatesSize = sizeof($monthlyDates); |
| 465 | 465 | |
| 466 | - if ($monthlyDatesSize < 1) { |
|
| 466 | + if ($monthlyDatesSize<1) { |
|
| 467 | 467 | return false; |
| 468 | 468 | } |
| 469 | 469 | |
| 470 | 470 | $isValid = true; |
| 471 | 471 | |
| 472 | - for ($i = 0; $i < $monthlyDatesSize; ++$i) { |
|
| 472 | + for ($i = 0; $i<$monthlyDatesSize; ++$i) { |
|
| 473 | 473 | if (is_numeric($monthlyDates[$i])) { |
| 474 | 474 | $mday = intval($monthlyDates[$i]); |
| 475 | - if ($mday < 1 || $mday > 31) { |
|
| 475 | + if ($mday<1 || $mday>31) { |
|
| 476 | 476 | $isValid = false; |
| 477 | 477 | } |
| 478 | 478 | } else { |
@@ -538,9 +538,9 @@ discard block |
||
| 538 | 538 | |
| 539 | 539 | $iRow = 1; |
| 540 | 540 | |
| 541 | - while (false !== ($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))) { |
|
| 541 | + while (false!==($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))) { |
|
| 542 | 542 | if (!isset($rows[$locationsFieldsMapping['cached_lat']]) || !isset($rows[$locationsFieldsMapping['cached_lng']]) |
| 543 | - || !isset($rows[$locationsFieldsMapping['address_1']]) || [null] == $rows) { |
|
| 543 | + || !isset($rows[$locationsFieldsMapping['address_1']]) || [null]==$rows) { |
|
| 544 | 544 | continue; |
| 545 | 545 | } |
| 546 | 546 | |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | if (isset($rows[$locationsFieldsMapping['schedule_every']])) { |
| 572 | 572 | if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) { |
| 573 | 573 | $curSchedule .= '"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; |
| 574 | - if ('daily' == $mode) { |
|
| 574 | + if ('daily'==$mode) { |
|
| 575 | 575 | $curSchedule = trim($curSchedule, ','); |
| 576 | 576 | $curSchedule .= '}'; |
| 577 | 577 | } |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | } |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | - if ('daily' != $mode) { |
|
| 583 | + if ('daily'!=$mode) { |
|
| 584 | 584 | switch ($mode) { |
| 585 | 585 | case 'weekly': |
| 586 | 586 | if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); |
| 607 | 607 | } |
| 608 | 608 | |
| 609 | - if ('' != $monthlyMode) { |
|
| 609 | + if (''!=$monthlyMode) { |
|
| 610 | 610 | switch ($monthlyMode) { |
| 611 | 611 | case 'dates': |
| 612 | 612 | if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); |
| 629 | 629 | } |
| 630 | 630 | |
| 631 | - if ('' != $curSchedule) { |
|
| 631 | + if (''!=$curSchedule) { |
|
| 632 | 632 | if (isset($rows[$locationsFieldsMapping['monthly_nth_what']])) { |
| 633 | 633 | if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_what']])) { |
| 634 | 634 | $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_what']].'}}'; |
@@ -649,11 +649,11 @@ discard block |
||
| 649 | 649 | } |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | - if (sizeof($results['fail']) > $failCount) { |
|
| 652 | + if (sizeof($results['fail'])>$failCount) { |
|
| 653 | 653 | $curSchedule = ''; |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | - if (('daily' == $mode || 'weekly' == $mode || 'monthy' == $mode) && '' == $curSchedule) { |
|
| 656 | + if (('daily'==$mode || 'weekly'==$mode || 'monthy'==$mode) && ''==$curSchedule) { |
|
| 657 | 657 | ++$iRow; |
| 658 | 658 | continue; |
| 659 | 659 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | * Values of the custom note type |
| 29 | 29 | * @var array |
| 30 | 30 | */ |
| 31 | - public $note_custom_type_values=[]; |
|
| 31 | + public $note_custom_type_values = []; |
|
| 32 | 32 | |
| 33 | 33 | public static function fromArray(array $params) |
| 34 | 34 | { |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | if (is_null($result) || !is_array($result)) return null; |
| 182 | 182 | |
| 183 | 183 | foreach ($result as $custNoteType) { |
| 184 | - if (isset($custNoteType["note_custom_type"]) && $custNoteType["note_custom_type"] == $params) { |
|
| 184 | + if (isset($custNoteType["note_custom_type"]) && $custNoteType["note_custom_type"]==$params) { |
|
| 185 | 185 | return $custNoteType; |
| 186 | 186 | } |
| 187 | 187 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $customArray = []; |
| 228 | 228 | |
| 229 | 229 | foreach ($params as $key => $value) { |
| 230 | - if (false !== strpos($key, 'custom_note_type')) { |
|
| 230 | + if (false!==strpos($key, 'custom_note_type')) { |
|
| 231 | 231 | $customArray[$key] = $value; |
| 232 | 232 | } |
| 233 | 233 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // Initialize cURL request headers |
| 57 | - if (0 == sizeof($this->_headers)) { |
|
| 57 | + if (0==sizeof($this->_headers)) { |
|
| 58 | 58 | $this->_headers = [ |
| 59 | 59 | 'MyQApplicationId' => $this->appId, |
| 60 | 60 | 'Culture' => $this->culture, |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $error[] = 'password'; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if (sizeof($error) > 0) { |
|
| 101 | + if (sizeof($error)>0) { |
|
| 102 | 102 | throw new MyQException('Missing required auth credential: '.implode(',', $error)); |
| 103 | 103 | } |
| 104 | 104 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $this->_locationName, |
| 114 | 114 | $this->_doorName, |
| 115 | 115 | $this->_doorState, |
| 116 | - (int) $timeInState, |
|
| 116 | + (int)$timeInState, |
|
| 117 | 117 | ]); |
| 118 | 118 | } |
| 119 | 119 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | $data = json_decode($output); |
| 172 | 172 | |
| 173 | - if (false == $data || !isset($data->SecurityToken)) { |
|
| 173 | + if (false==$data || !isset($data->SecurityToken)) { |
|
| 174 | 174 | throw new MyQException("Error processing login request: $output"); |
| 175 | 175 | } |
| 176 | 176 | |
@@ -190,16 +190,16 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | $data = json_decode($output); |
| 192 | 192 | |
| 193 | - if (false == $data || !isset($data->Devices)) { |
|
| 193 | + if (false==$data || !isset($data->Devices)) { |
|
| 194 | 194 | throw new MyQException("Error fetching device details: $output"); |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | // Find our door device ID |
| 198 | 198 | foreach ($data->Devices as $device) { |
| 199 | - if (false !== stripos($device->MyQDeviceTypeName, 'Gateway')) { |
|
| 199 | + if (false!==stripos($device->MyQDeviceTypeName, 'Gateway')) { |
|
| 200 | 200 | // Find location name |
| 201 | 201 | foreach ($device->Attributes as $attr) { |
| 202 | - if ('desc' == $attr->AttributeDisplayName) { |
|
| 202 | + if ('desc'==$attr->AttributeDisplayName) { |
|
| 203 | 203 | $this->_locationName = $attr->Value; |
| 204 | 204 | } |
| 205 | 205 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | case 'doorstate': |
| 216 | 216 | $this->_doorState = $attr->Value; |
| 217 | 217 | // UpdatedTime is a timestamp in ms, so we truncate |
| 218 | - $this->_doorStateTime = (int) $attr->UpdatedTime / 1000; |
|
| 218 | + $this->_doorStateTime = (int)$attr->UpdatedTime / 1000; |
|
| 219 | 219 | break; |
| 220 | 220 | default: |
| 221 | 221 | continue; |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | // set multipart form data - file array field-value pairs |
| 287 | 287 | if (!empty($file_field_array)) { |
| 288 | 288 | foreach ($file_field_array as $var_name => $var_value) { |
| 289 | - if (false !== strpos(PHP_OS, 'WIN')) { |
|
| 289 | + if (false!==strpos(PHP_OS, 'WIN')) { |
|
| 290 | 290 | $var_value = str_replace('/', '\\', $var_value); |
| 291 | 291 | } // win hack |
| 292 | 292 | $file_field_array[$var_name] = '@'.$var_value; |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | static $curl_loops = 0; |
| 390 | 390 | static $curl_max_loops = 20; |
| 391 | 391 | |
| 392 | - if ($curl_loops++ >= $curl_max_loops) { |
|
| 392 | + if ($curl_loops++>=$curl_max_loops) { |
|
| 393 | 393 | $curl_loops = 0; |
| 394 | 394 | |
| 395 | 395 | return false; |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | //echo "*** Got HTTP code: $http_code ***\n"; |
| 408 | 408 | //echo "** Got headers: \n$header\n\n"; |
| 409 | 409 | |
| 410 | - if (301 == $http_code || 302 == $http_code) { |
|
| 410 | + if (301==$http_code || 302==$http_code) { |
|
| 411 | 411 | // If we're redirected, we should revert to GET |
| 412 | 412 | curl_setopt($ch, CURLOPT_HTTPGET, true); |
| 413 | 413 | |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | /** @var string $geofence_polygon_shape |
| 54 | 54 | * Geofence polygon shape. ENUM('circle', 'poly', 'rect'). |
| 55 | 55 | */ |
| 56 | - public $geofence_polygon_shape ; |
|
| 56 | + public $geofence_polygon_shape; |
|
| 57 | 57 | |
| 58 | 58 | /** @var int $geofence_polygon_size |
| 59 | 59 | * Geofence polygon size |
@@ -147,7 +147,7 @@ |
||
| 147 | 147 | * If specified, it contains the key 'config_key' and retrieved only corresponding configuration data, |
| 148 | 148 | * if not, all member configuration data retrieved. |
| 149 | 149 | */ |
| 150 | - public function GetConfigurationData($params=null) |
|
| 150 | + public function GetConfigurationData($params = null) |
|
| 151 | 151 | { |
| 152 | 152 | $allQueryFields = ['config_key']; |
| 153 | 153 | |
@@ -163,13 +163,13 @@ |
||
| 163 | 163 | |
| 164 | 164 | foreach ($members['results'] as $memb) { |
| 165 | 165 | if (isset($memb['member_id']) && isset($memb['member_type'])) { |
| 166 | - if ($memberType == $memb['member_type']) { |
|
| 166 | + if ($memberType==$memb['member_type']) { |
|
| 167 | 167 | $memberIDs[] = $memb['member_id']; |
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - if (sizeof($memberIDs) < 1) { |
|
| 172 | + if (sizeof($memberIDs)<1) { |
|
| 173 | 173 | return null; |
| 174 | 174 | } |
| 175 | 175 | |