Skip to content

Commit

Permalink
refactor: make logic more readible with early returns
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Waldstein committed Jan 17, 2025
1 parent 0e8d12c commit 3dbd9a6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Subscriptions/Models/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ public function totalDonations(): int
*/
public function shouldEndSubscription(): bool
{
return !$this->isIndefinite() && ($this->totalDonations() >= $this->installments);
if ($this->isIndefinite()) {
return false;
}

return $this->totalDonations() >= $this->installments;
}

/**
Expand Down

0 comments on commit 3dbd9a6

Please sign in to comment.