| @@ 10-21 (lines=12) @@ | ||
| 7 | */ |
|
| 8 | namespace AnimeDb\SmartSleep\Rule; |
|
| 9 | ||
| 10 | class EverydayRule extends RandMaxSecondsRuleBase |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * @param \DateTime $time |
|
| 14 | * |
|
| 15 | * @return bool |
|
| 16 | */ |
|
| 17 | public function isMatched(\DateTime $time) |
|
| 18 | { |
|
| 19 | return $this->getStart() <= $time->format('G') && $this->getEnd() > $time->format('G'); |
|
| 20 | } |
|
| 21 | } |
|
| 22 | ||
| @@ 10-23 (lines=14) @@ | ||
| 7 | */ |
|
| 8 | namespace AnimeDb\SmartSleep\Rule; |
|
| 9 | ||
| 10 | class HolidayRule extends RandMaxSecondsRuleBase |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * @param \DateTime $time |
|
| 14 | * |
|
| 15 | * @return bool |
|
| 16 | */ |
|
| 17 | public function isMatched(\DateTime $time) |
|
| 18 | { |
|
| 19 | return $time->format('N') > 5 && |
|
| 20 | $this->getStart() <= $time->format('G') && |
|
| 21 | $this->getEnd() > $time->format('G'); |
|
| 22 | } |
|
| 23 | } |
|
| 24 | ||
| @@ 10-23 (lines=14) @@ | ||
| 7 | */ |
|
| 8 | namespace AnimeDb\SmartSleep\Rule; |
|
| 9 | ||
| 10 | class WeekdayRule extends RandMaxSecondsRuleBase |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * @param \DateTime $time |
|
| 14 | * |
|
| 15 | * @return bool |
|
| 16 | */ |
|
| 17 | public function isMatched(\DateTime $time) |
|
| 18 | { |
|
| 19 | return $time->format('N') <= 5 && |
|
| 20 | $this->getStart() <= $time->format('G') && |
|
| 21 | $this->getEnd() > $time->format('G'); |
|
| 22 | } |
|
| 23 | } |
|
| 24 | ||