Skip to content

Commit

Permalink
refactor: recurrenceIsActive logic
Browse files Browse the repository at this point in the history
  • Loading branch information
frknasir committed Nov 9, 2022
1 parent 59fc07e commit c11880c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Recurs.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,8 @@ public function pauseRecurrence(bool $value = true)
*/
public function recurrenceIsActive(): bool
{
return ($this->recurrence?->starts_at >= now()) &&
$this->recurrence?->status === 'active' && (
(! is_null($this->recurrence->ends_at) && ($this->recurrence->ends_at >= now())) ||
(! is_null($this->recurrence->ends_after) && $this->nextRecurrence()) ||
(is_null($this->recurrence->ends_at) && is_null($this->recurrence->ends_after))
);
return $this->recurrence?->status === 'active' &&
!!$this->nextRecurrence();
}

/**
Expand Down

0 comments on commit c11880c

Please sign in to comment.