Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
esyede committed Nov 23, 2023
1 parent 15a6ec5 commit 7b5c052
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions system/carbon.php
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ public function toW3cString()

public function eq(Carbon $dt)
{
$this->validate($dt);
$this->checkComparator($dt);
return $this == $dt; // '==' memang disengaja
}

Expand All @@ -482,25 +482,25 @@ public function ne(Carbon $dt)

public function gt(Carbon $dt)
{
$this->validate($dt);
$this->checkComparator($dt);
return $this > $dt;
}

public function gte(Carbon $dt)
{
$this->validate($dt);
$this->checkComparator($dt);
return $this >= $dt;
}

public function lt(Carbon $dt)
{
$this->validate($dt);
$this->checkComparator($dt);
return $this < $dt;
}

public function lte(Carbon $dt)
{
$this->validate($dt);
$this->checkComparator($dt);
return $this <= $dt;
}

Expand Down Expand Up @@ -1028,7 +1028,7 @@ public function isBirthday(Carbon $dt)
return $this->format('md') === $dt->format('md');
}

private function validate($dt)
private function checkComparator($dt)
{
if ($dt === null || is_bool($dt)) {
throw new \Exception('Cannot compare with null or boolean value');
Expand Down

0 comments on commit 7b5c052

Please sign in to comment.