Minor cosmetic changes

This commit is contained in:
Tim 2024-10-21 23:39:05 +02:00
parent 7bc2e364a8
commit 3522bf245f
2 changed files with 4 additions and 6 deletions

View File

@ -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

View File

@ -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);
}