From 3522bf245f8945f45b8244b9008baaf53fb478a3 Mon Sep 17 00:00:00 2001 From: ardent Date: Mon, 21 Oct 2024 23:39:05 +0200 Subject: [PATCH] Minor cosmetic changes --- src/Service/RuleChecker.php | 2 -- src/Service/Rules/TimeRule.php | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Service/RuleChecker.php b/src/Service/RuleChecker.php index 8647ac4..719e9d6 100755 --- a/src/Service/RuleChecker.php +++ b/src/Service/RuleChecker.php @@ -2,10 +2,8 @@ namespace App\Service; -use App\Dto\Player; use App\Service\Rules\AbstractRule; use App\Service\Rules\PlayTimeRule; -use App\Service\Rules\RuleResult; use App\Service\Rules\TimeRule; class RuleChecker diff --git a/src/Service/Rules/TimeRule.php b/src/Service/Rules/TimeRule.php index 6a23fe3..6400800 100755 --- a/src/Service/Rules/TimeRule.php +++ b/src/Service/Rules/TimeRule.php @@ -7,8 +7,8 @@ use App\Dto\Player; class TimeRule extends AbstractRule { public function __construct( - private readonly string $start = '21:00', - private readonly string $end = '23:59', + private readonly string $start = '19:00', + private readonly string $end = '23:00', ) {} public function check(Player $player): RuleResult @@ -16,11 +16,11 @@ class TimeRule extends AbstractRule $now = new \DateTimeImmutable(); $start = new \DateTimeImmutable($this->start); $end = new \DateTimeImmutable($this->end); - $fiveMinutesBeforeEnd = $end->sub(new \DateInterval('PT5M')); if ($now >= $start && $now <= $end) { + $fiveMinutesBeforeEnd = $end->sub(new \DateInterval('PT5M')); if ($now >= $fiveMinutesBeforeEnd) { - return new RuleResult(RuleResultEnum::WARNING, 'Less than 5 minutes remaining'); + return new RuleResult(RuleResultEnum::WARNING, 'Only 5 minutes remaining'); } return new RuleResult(RuleResultEnum::ALLOWED); }