date = $date; $this->rule = $rule; $this->rule_id = $rule_id; $this->label = $label; $this->ranges = $ranges; $this->windows = $windows; } /** * Local date, `Y-m-d`. * * @return string */ public function get_date() { return $this->date; } /** * The winning rule type: `weekly`, `special` or `closure`. * * @return string */ public function get_rule() { return $this->rule; } /** * Id of the winning special-hours entry or closure; null for weekly hours. * * @return string|null */ public function get_rule_id() { return $this->rule_id; } /** * The winning rule as one key: `weekly`, `special:{id}` or `closure:{id}`. * * @return string */ public function get_rule_key() { return null === $this->rule_id ? $this->rule : $this->rule . ':' . $this->rule_id; } /** * Label of the winning entry; empty for weekly hours or an unlabelled entry. * * @return string */ public function get_label() { return $this->label; } /** * The date's own local ranges, sorted by start. Empty when closed. * * @return TimeRange[] */ public function get_ranges() { return $this->ranges; } /** * UTC windows of the date's own ranges, sorted by start. A range running * past midnight ends on the next date (or at midnight, when the next date * is a closure). The previous night's spill-over is not included. * * @return Window[] */ public function get_windows() { return $this->windows; } }