Files
firefly-iii/app/Repositories/Budget/BudgetRepositoryInterface.php

133 lines
3.0 KiB
PHP
Raw Normal View History

2015-02-22 09:46:21 +01:00
<?php
2016-02-05 12:08:25 +01:00
declare(strict_types = 1);
2015-02-22 09:46:21 +01:00
namespace FireflyIII\Repositories\Budget;
2015-02-23 21:19:16 +01:00
use Carbon\Carbon;
2015-02-22 09:46:21 +01:00
use FireflyIII\Models\Budget;
2016-04-05 22:00:03 +02:00
use FireflyIII\Models\BudgetLimit;
2015-04-05 10:36:28 +02:00
use Illuminate\Support\Collection;
2015-02-23 21:19:16 +01:00
2015-02-22 09:46:21 +01:00
/**
* Interface BudgetRepositoryInterface
*
* @package FireflyIII\Repositories\Budget
*/
interface BudgetRepositoryInterface
{
2016-01-01 19:46:12 +01:00
2016-05-06 06:15:46 +02:00
/**
* @param Budget $budget
*
* @return bool
*/
public function destroy(Budget $budget): bool;
2015-12-29 08:27:13 +01:00
/**
2016-05-06 06:15:46 +02:00
* Find a budget.
2015-12-29 08:27:13 +01:00
*
2016-05-06 06:15:46 +02:00
* @param int $budgetId
*
* @return Budget
2015-12-29 08:27:13 +01:00
*/
2016-05-06 06:15:46 +02:00
public function find(int $budgetId): Budget;
2015-12-29 08:27:13 +01:00
/**
* This method returns the oldest journal or transaction date known to this budget.
* Will cache result.
2016-05-11 09:08:18 +02:00
*
* @param Budget $budget
*
* @return Carbon
*/
public function firstUseDate(Budget $budget): Carbon;
2016-04-01 13:17:07 +02:00
/**
2016-05-06 06:15:46 +02:00
* @return Collection
2016-04-01 13:17:07 +02:00
*/
2016-05-06 06:15:46 +02:00
public function getActiveBudgets(): Collection;
2016-04-01 13:17:07 +02:00
/**
* @param Carbon $start
* @param Carbon $end
2016-01-01 13:54:23 +01:00
*
2016-01-20 15:21:27 +01:00
* @return Collection
2016-01-01 13:54:23 +01:00
*/
2016-05-05 22:03:35 +02:00
public function getAllBudgetLimitRepetitions(Carbon $start, Carbon $end): Collection;
2016-05-06 06:15:46 +02:00
/**
* @return Collection
*/
public function getBudgets(): Collection;
2015-02-22 15:40:13 +01:00
/**
2016-01-20 15:21:27 +01:00
* @return Collection
2015-02-22 15:40:13 +01:00
*/
2016-05-06 06:15:46 +02:00
public function getInactiveBudgets(): Collection;
2015-02-22 09:46:21 +01:00
2015-04-05 10:36:28 +02:00
/**
2016-05-06 06:15:46 +02:00
* @param Collection $budgets
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
2015-04-05 10:36:28 +02:00
* @return Collection
*/
2016-05-06 06:15:46 +02:00
public function journalsInPeriod(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): Collection;
/**
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function journalsInPeriodWithoutBudget(Collection $accounts, Carbon $start, Carbon $end): Collection;
2016-05-11 09:08:18 +02:00
/**
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return string
*/
public function spentInPeriodWithoutBudget(Collection $accounts, Carbon $start, Carbon $end): string;
2016-05-06 06:15:46 +02:00
/**
* @param Collection $budgets
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return string
*/
public function spentInPeriod(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end) : string;
2015-04-05 10:36:28 +02:00
2015-02-22 15:40:13 +01:00
/**
* @param array $data
*
* @return Budget
*/
2016-04-05 22:00:03 +02:00
public function store(array $data): Budget;
2015-02-22 15:40:13 +01:00
/**
* @param Budget $budget
2015-02-23 21:19:16 +01:00
* @param array $data
2015-02-22 15:40:13 +01:00
*
* @return Budget
*/
2016-04-05 22:00:03 +02:00
public function update(Budget $budget, array $data) : Budget;
2015-02-22 15:40:13 +01:00
/**
* @param Budget $budget
2016-04-28 10:59:36 +02:00
* @param Carbon $start
* @param Carbon $end
* @param string $range
2016-03-03 09:05:09 +01:00
* @param int $amount
2015-02-22 15:40:13 +01:00
*
2016-04-05 22:00:03 +02:00
* @return BudgetLimit
2015-02-22 15:40:13 +01:00
*/
2016-04-28 10:59:36 +02:00
public function updateLimitAmount(Budget $budget, Carbon $start, Carbon $end, string $range, int $amount) : BudgetLimit;
2015-02-22 15:40:13 +01:00
2015-03-29 08:14:32 +02:00
}