You are here

protected function ActiveHours::build in SMS Framework 2.x

Same name and namespace in other branches
  1. 8 modules/sms_user/src/ActiveHours.php \Drupal\sms_user\ActiveHours::build()
  2. 2.1.x modules/sms_user/src/ActiveHours.php \Drupal\sms_user\ActiveHours::build()

Store the active hours configuration state.

2 calls to ActiveHours::build()
ActiveHours::getRanges in modules/sms_user/src/ActiveHours.php
Get ranges converted to local timezone and sorted chronologically.
ActiveHours::inHours in modules/sms_user/src/ActiveHours.php
Determine if the current time of a user is within permitted hour ranges.

File

modules/sms_user/src/ActiveHours.php, line 132

Class

ActiveHours
Defines the user active hours service.

Namespace

Drupal\sms_user

Code

protected function build() {
  if (isset($this->status)) {
    return;
  }
  $settings = $this->configFactory
    ->get('sms_user.settings')
    ->get('active_hours');
  $this->status = !empty($settings['status']);
  $this->ranges = !empty($settings['ranges']) ? $settings['ranges'] : [];
}