You are here

interface ActiveHoursInterface in SMS Framework 8

Same name and namespace in other branches
  1. 2.x modules/sms_user/src/ActiveHoursInterface.php \Drupal\sms_user\ActiveHoursInterface
  2. 2.1.x modules/sms_user/src/ActiveHoursInterface.php \Drupal\sms_user\ActiveHoursInterface

Defines interface for the user active hours service.

Hierarchy

Expanded class hierarchy of ActiveHoursInterface

All classes that implement ActiveHoursInterface

File

modules/sms_user/src/ActiveHoursInterface.php, line 11

Namespace

Drupal\sms_user
View source
interface ActiveHoursInterface {

  /**
   * Determine if the current time of a user is within permitted hour ranges.
   *
   * @param \Drupal\user\UserInterface $user
   *   A user entity.
   * @param string $now
   *   The local time for the user. Defaults to current time.
   *
   * @return bool
   *   Whether the current time for a user is within active hours.
   */
  public function inHours(UserInterface $user, $now = 'now');

  /**
   * Determine the next valid active hours date range for a user.
   *
   * @param \Drupal\user\UserInterface $user
   *   A user entity.
   * @param string $now
   *   A time or strtotime() relative string localised to the users timezone.
   *   Defaults to current time for the user.
   *
   * @return \Drupal\sms_user\ActiveHoursDates|false
   *   A date pair, or FALSE if no next date could be determined.
   */
  public function findNextTime(UserInterface $user, $now = 'now');

  /**
   * Delay a SMS message if active hours require it to be delayed.
   *
   * @param \Drupal\sms\Entity\SmsMessageInterface $sms_message
   *   An SMS message entity.
   */
  public function delaySmsMessage(SmsMessageInterface &$sms_message);

  /**
   * Get ranges converted to local timezone and sorted chronologically.
   *
   * @param string|\DateTimeZone $timezone
   *   A timezone string or object.
   *
   * @return \Drupal\sms_user\ActiveHoursDates[]
   *   A array of date pairs sorted chronologically by start dates.
   */
  public function getRanges($timezone);

}

Members

Namesort descending Modifiers Type Description Overrides
ActiveHoursInterface::delaySmsMessage public function Delay a SMS message if active hours require it to be delayed. 1
ActiveHoursInterface::findNextTime public function Determine the next valid active hours date range for a user. 1
ActiveHoursInterface::getRanges public function Get ranges converted to local timezone and sorted chronologically. 1
ActiveHoursInterface::inHours public function Determine if the current time of a user is within permitted hour ranges. 1