Skip to content

Commit

Permalink
renme to phase
Browse files Browse the repository at this point in the history
  • Loading branch information
cevro committed Mar 20, 2024
1 parent 52e4cf2 commit 4cbcbeb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/DateTime/DateTimePeriod.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,25 @@ public function isOnGoing(?\DateTimeInterface $dateTime = null): bool
&& $this->end->getTimestamp() >= $timeStamp;
}

public function is(Period $period, ?\DateTimeInterface $dateTime = null): bool
public function is(Phase $period, ?\DateTimeInterface $dateTime = null): bool
{
return match ($period) {
Period::before => $this->isBefore($dateTime),
Period::after => $this->isAfter($dateTime),
Period::onGoing => $this->isOnGoing($dateTime)
Phase::before => $this->isBefore($dateTime),
Phase::after => $this->isAfter($dateTime),
Phase::onGoing => $this->isOnGoing($dateTime)
};
}

public function getPeriod(?\DateTimeInterface $dateTime = null): Period
public function getPhase(?\DateTimeInterface $dateTime = null): Phase
{
if ($this->isBefore($dateTime)) {
return Period::before;
return Phase::before;
}
if ($this->isAfter($dateTime)) {
return Period::after;
return Phase::after;
}
if ($this->isOnGoing($dateTime)) {
return Period::onGoing;
return Phase::onGoing;
}
throw new \LogicException();
}
Expand Down
2 changes: 1 addition & 1 deletion src/DateTime/Period.php → src/DateTime/Phase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Fykosak\Utils\DateTime;

enum Period
enum Phase
{
case before;
case after;
Expand Down

0 comments on commit 4cbcbeb

Please sign in to comment.