Minor cosmetic changes
This commit is contained in:
parent
7bc2e364a8
commit
3522bf245f
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user