This commit is contained in:
parent
a4f62868fd
commit
6f23c3c1b7
3 changed files with 132 additions and 2 deletions
|
@ -58,7 +58,7 @@ class FoodOrder
|
|||
return $this->closedAt;
|
||||
}
|
||||
|
||||
public function setClosedAt(DateTimeImmutable|null $closedAt): static
|
||||
public function setClosedAt(DateTimeImmutable|null $closedAt = null): static
|
||||
{
|
||||
$this->closedAt = $closedAt;
|
||||
|
||||
|
@ -67,7 +67,15 @@ class FoodOrder
|
|||
|
||||
public function isClosed(): bool
|
||||
{
|
||||
return $this->closedAt instanceof DateTimeImmutable && $this->closedAt->getTimestamp() <= (new DateTimeImmutable)->getTimestamp();
|
||||
if ($this->closedAt === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->closedAt < new DateTimeImmutable) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function close(): static
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue