Lots of new code for recurring transactions. #1469

This commit is contained in:
James Cole
2018-06-16 21:47:51 +02:00
parent 968abd26e8
commit 1cf91c78f8
19 changed files with 769 additions and 79 deletions

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Repositories\Recurring;
use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Recurrence;
use FireflyIII\Models\RecurrenceRepetition;
use FireflyIII\User;
@@ -53,6 +54,19 @@ interface RecurringRepositoryInterface
*/
public function getNoteText(Recurrence $recurrence): string;
/**
* Generate events in the date range.
*
* @param RecurrenceRepetition $repetition
* @param Carbon $start
* @param Carbon $end
*
* @throws FireflyException
*
* @return array
*/
public function getOccurrencesInRange(RecurrenceRepetition $repetition, Carbon $start, Carbon $end): array;
/**
* Calculate the next X iterations starting on the date given in $date.
* Returns an array of Carbon objects.
@@ -61,9 +75,10 @@ interface RecurringRepositoryInterface
* @param Carbon $date
* @param int $count
*
* @throws FireflyException
* @return array
*/
public function getXOccurrences(RecurrenceRepetition $repetition, Carbon $date, int $count = 5): array;
public function getXOccurrences(RecurrenceRepetition $repetition, Carbon $date, int $count): array;
/**
* Parse the repetition in a string that is user readable.
@@ -81,4 +96,12 @@ interface RecurringRepositoryInterface
*/
public function setUser(User $user): void;
/**
* @param array $data
*
* @throws FireflyException
* @return Recurrence
*/
public function store(array $data): Recurrence;
}