This breaks everything budget-related.

This commit is contained in:
James Cole
2016-05-05 22:03:35 +02:00
parent dd8b500efd
commit adf6691470
7 changed files with 1219 additions and 1223 deletions

View File

@@ -4,11 +4,8 @@ declare(strict_types = 1);
namespace FireflyIII\Repositories\Budget;
use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Models\Budget;
use FireflyIII\Models\BudgetLimit;
use FireflyIII\Models\LimitRepetition;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
/**
@@ -19,23 +16,23 @@ use Illuminate\Support\Collection;
interface BudgetRepositoryInterface
{
/**
*
* Same as ::spentInPeriod but corrects journals for a set of accounts
*
* @param Budget $budget
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
*
* @return string
*/
public function balanceInPeriod(Budget $budget, Carbon $start, Carbon $end, Collection $accounts);
// /**
// *
// * Same as ::spentInPeriod but corrects journals for a set of accounts
// *
// * @param Budget $budget
// * @param Carbon $start
// * @param Carbon $end
// * @param Collection $accounts
// *
// * @return string
// */
// public function balanceInPeriod(Budget $budget, Carbon $start, Carbon $end, Collection $accounts);
/**
* @return bool
*/
public function cleanupBudgets(): bool;
// /**
// * @return bool
// */
// public function cleanupBudgets(): bool;
/**
* @param Budget $budget
@@ -44,15 +41,15 @@ interface BudgetRepositoryInterface
*/
public function destroy(Budget $budget): bool;
/**
* @param Budget $budget
* @param Account $account
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function expensesSplit(Budget $budget, Account $account, Carbon $start, Carbon $end): Collection;
// /**
// * @param Budget $budget
// * @param Account $account
// * @param Carbon $start
// * @param Carbon $end
// *
// * @return Collection
// */
// public function expensesSplit(Budget $budget, Account $account, Carbon $start, Carbon $end): Collection;
/**
* Find a budget.
@@ -63,12 +60,12 @@ interface BudgetRepositoryInterface
*/
public function find(int $budgetId): Budget;
/**
* @param Budget $budget
*
* @return Carbon
*/
public function firstActivity(Budget $budget): Carbon;
// /**
// * @param Budget $budget
// *
// * @return Carbon
// */
// public function firstActivity(Budget $budget): Carbon;
/**
* @return Collection
@@ -78,209 +75,208 @@ interface BudgetRepositoryInterface
/**
* @param Carbon $start
* @param Carbon $end
* @param Budget $budget
*
* @return Collection
*/
public function getAllBudgetLimitRepetitions(Carbon $start, Carbon $end, Budget $budget = null): Collection;
public function getAllBudgetLimitRepetitions(Carbon $start, Carbon $end): Collection;
/**
* @param Account $account
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function getAllWithoutBudget(Account $account, Collection $accounts, Carbon $start, Carbon $end): Collection;
// /**
// * @param Account $account
// * @param Collection $accounts
// * @param Carbon $start
// * @param Carbon $end
// *
// * @return Collection
// */
// public function getAllWithoutBudget(Account $account, Collection $accounts, Carbon $start, Carbon $end): Collection;
/**
* Get the budgeted amounts for each budgets in each year.
*
* @param Collection $budgets
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function getBudgetedPerYear(Collection $budgets, Carbon $start, Carbon $end): Collection;
// /**
// * Get the budgeted amounts for each budgets in each year.
// *
// * @param Collection $budgets
// * @param Carbon $start
// * @param Carbon $end
// *
// * @return Collection
// */
// public function getBudgetedPerYear(Collection $budgets, Carbon $start, Carbon $end): Collection;
/**
* @return Collection
*/
public function getBudgets(): Collection;
/**
* Returns an array with every budget in it and the expenses for each budget
* per month.
*
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
public function getBudgetsAndExpensesPerMonth(Collection $accounts, Carbon $start, Carbon $end): array;
// /**
// * Returns an array with every budget in it and the expenses for each budget
// * per month.
// *
// * @param Collection $accounts
// * @param Carbon $start
// * @param Carbon $end
// *
// * @return array
// */
// public function getBudgetsAndExpensesPerMonth(Collection $accounts, Carbon $start, Carbon $end): array;
/**
* Returns an array with every budget in it and the expenses for each budget
* per year for.
*
* @param Collection $budgets
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @deprecated
*
* @return array
*/
public function getBudgetsAndExpensesPerYear(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): array;
// /**
// * Returns an array with every budget in it and the expenses for each budget
// * per year for.
// *
// * @param Collection $budgets
// * @param Collection $accounts
// * @param Carbon $start
// * @param Carbon $end
// *
// * @deprecated
// *
// * @return array
// */
// public function getBudgetsAndExpensesPerYear(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): array;
/**
* Returns a list of budgets, budget limits and limit repetitions
* (doubling any of them in a left join)
*
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function getBudgetsAndLimitsInRange(Carbon $start, Carbon $end): Collection;
// /**
// * Returns a list of budgets, budget limits and limit repetitions
// * (doubling any of them in a left join)
// *
// * @param Carbon $start
// * @param Carbon $end
// *
// * @return Collection
// */
// public function getBudgetsAndLimitsInRange(Carbon $start, Carbon $end): Collection;
/**
* Returns a list of budget limits that are valid in the current given range.
*
* @param Budget $budget
* @param Carbon $start
* @param Carbon $end
* @param LimitRepetition $ignore
*
* @return Collection
*/
public function getValidRepetitions(Budget $budget, Carbon $start, Carbon $end, LimitRepetition $ignore) : Collection;
// /**
// * Returns a list of budget limits that are valid in the current given range.
// *
// * @param Budget $budget
// * @param Carbon $start
// * @param Carbon $end
// * @param LimitRepetition $ignore
// *
// * @return Collection
// */
// public function getValidRepetitions(Budget $budget, Carbon $start, Carbon $end, LimitRepetition $ignore) : Collection;
/**
* @param Budget $budget
* @param string $repeatFreq
* @param Carbon $start
* @param Carbon $end
*
* @return LimitRepetition
*/
public function getCurrentRepetition(Budget $budget, string $repeatFreq, Carbon $start, Carbon $end): LimitRepetition;
// /**
// * @param Budget $budget
// * @param string $repeatFreq
// * @param Carbon $start
// * @param Carbon $end
// *
// * @return LimitRepetition
// */
// public function getCurrentRepetition(Budget $budget, string $repeatFreq, Carbon $start, Carbon $end): LimitRepetition;
/**
* Returns all expenses for the given budget and the given accounts, in the given period.
*
* @param Budget $budget
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function getExpenses(Budget $budget, Collection $accounts, Carbon $start, Carbon $end):Collection;
// /**
// * Returns all expenses for the given budget and the given accounts, in the given period.
// *
// * @param Budget $budget
// * @param Collection $accounts
// * @param Carbon $start
// * @param Carbon $end
// *
// * @return Collection
// */
// public function getExpenses(Budget $budget, Collection $accounts, Carbon $start, Carbon $end):Collection;
/**
* @param Budget $budget
*
* @return Carbon
*/
public function getFirstBudgetLimitDate(Budget $budget):Carbon;
// /**
// * @param Budget $budget
// *
// * @return Carbon
// */
// public function getFirstBudgetLimitDate(Budget $budget):Carbon;
/**
* @return Collection
*/
public function getInactiveBudgets(): Collection;
/**
* Returns all the transaction journals for a limit, possibly limited by a limit repetition.
*
* @param Budget $budget
* @param LimitRepetition $repetition
* @param int $take
*
* @return LengthAwarePaginator
*/
public function getJournals(Budget $budget, LimitRepetition $repetition = null, int $take = 50): LengthAwarePaginator;
// /**
// * Returns all the transaction journals for a limit, possibly limited by a limit repetition.
// *
// * @param Budget $budget
// * @param LimitRepetition $repetition
// * @param int $take
// *
// * @return LengthAwarePaginator
// */
// public function getJournals(Budget $budget, LimitRepetition $repetition = null, int $take = 50): LengthAwarePaginator;
/**
* @param Carbon $start
* @param Carbon $end
* @param int $page
* @param int $pageSize
*
* @return LengthAwarePaginator
*/
public function getWithoutBudget(Carbon $start, Carbon $end, int $page, int $pageSize = 50): LengthAwarePaginator;
// /**
// * @param Carbon $start
// * @param Carbon $end
// * @param int $page
// * @param int $pageSize
// *
// * @return LengthAwarePaginator
// */
// public function getWithoutBudget(Carbon $start, Carbon $end, int $page, int $pageSize = 50): LengthAwarePaginator;
/**
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function getWithoutBudgetForAccounts(Collection $accounts, Carbon $start, Carbon $end): Collection;
// /**
// * @param Collection $accounts
// * @param Carbon $start
// * @param Carbon $end
// *
// * @return Collection
// */
// public function getWithoutBudgetForAccounts(Collection $accounts, Carbon $start, Carbon $end): Collection;
/**
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return string
*/
public function getWithoutBudgetSum(Collection $accounts, Carbon $start, Carbon $end): string;
// /**
// * @param Collection $accounts
// * @param Carbon $start
// * @param Carbon $end
// *
// * @return string
// */
// public function getWithoutBudgetSum(Collection $accounts, Carbon $start, Carbon $end): string;
/**
* Returns an array with the following key:value pairs:
*
* yyyy-mm-dd:<array>
*
* That array contains:
*
* budgetid:<amount>
*
* Where yyyy-mm-dd is the date and <amount> is the money spent using WITHDRAWALS in the $budget
* from the given users accounts..
*
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
public function spentAllPerDayForAccounts(Collection $accounts, Carbon $start, Carbon $end): array;
// /**
// * Returns an array with the following key:value pairs:
// *
// * yyyy-mm-dd:<array>
// *
// * That array contains:
// *
// * budgetid:<amount>
// *
// * Where yyyy-mm-dd is the date and <amount> is the money spent using WITHDRAWALS in the $budget
// * from the given users accounts..
// *
// * @param Collection $accounts
// * @param Carbon $start
// * @param Carbon $end
// *
// * @return array
// */
// public function spentAllPerDayForAccounts(Collection $accounts, Carbon $start, Carbon $end): array;
/**
* Returns a list of expenses (in the field "spent", grouped per budget per account.
*
* @param Collection $budgets
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function spentPerBudgetPerAccount(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): Collection;
// /**
// * Returns a list of expenses (in the field "spent", grouped per budget per account.
// *
// * @param Collection $budgets
// * @param Collection $accounts
// * @param Carbon $start
// * @param Carbon $end
// *
// * @return Collection
// */
// public function spentPerBudgetPerAccount(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): Collection;
/**
* Returns an array with the following key:value pairs:
*
* yyyy-mm-dd:<amount>
*
* Where yyyy-mm-dd is the date and <amount> is the money spent using WITHDRAWALS in the $budget
* from all the users accounts.
*
* @param Budget $budget
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
*
* @return array
*/
public function spentPerDay(Budget $budget, Carbon $start, Carbon $end, Collection $accounts): array;
// /**
// * Returns an array with the following key:value pairs:
// *
// * yyyy-mm-dd:<amount>
// *
// * Where yyyy-mm-dd is the date and <amount> is the money spent using WITHDRAWALS in the $budget
// * from all the users accounts.
// *
// * @param Budget $budget
// * @param Carbon $start
// * @param Carbon $end
// * @param Collection $accounts
// *
// * @return array
// */
// public function spentPerDay(Budget $budget, Carbon $start, Carbon $end, Collection $accounts): array;
/**
* @param array $data