Various code cleanup.

This commit is contained in:
James Cole
2020-10-31 08:00:44 +01:00
parent 55c8b9012c
commit c8a87833c6
15 changed files with 28 additions and 110 deletions

View File

@@ -35,14 +35,10 @@ use Throwable;
*/
class MonthReportGenerator implements ReportGeneratorInterface
{
/** @var Collection The accounts involved in the report. */
private $accounts;
/** @var Carbon The end date */
private $end;
/** @var Collection The expense accounts. */
private $expense;
/** @var Carbon The start date. */
private $start;
private Collection $accounts;
private Carbon $end;
private Collection $expense;
private Carbon $start;
/**
* Generate the report.

View File

@@ -41,16 +41,11 @@ use Throwable;
*/
class MonthReportGenerator implements ReportGeneratorInterface
{
/** @var Collection The accounts in the report. */
private $accounts;
/** @var Collection The budgets in the report. */
private $budgets;
/** @var Carbon The end date. */
private $end;
/** @var array The expenses in the report. */
private $expenses;
/** @var Carbon The start date. */
private $start;
private Collection $accounts;
private Collection $budgets;
private Carbon $end;
private array $expenses;
private Carbon $start;
/**
* MonthReportGenerator constructor.

View File

@@ -244,20 +244,6 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
/**
* Limit the result to a specific transaction group.
*
* @param TransactionGroup $transactionGroup
*
* @return GroupCollectorInterface
*/
public function setGroup(TransactionGroup $transactionGroup): GroupCollectorInterface
{
$this->query->where('transaction_groups.id', $transactionGroup->id);
return $this;
}
/**
* Limit the result to a set of specific journals.
*

View File

@@ -238,15 +238,6 @@ interface GroupCollectorInterface
*/
public function setDestinationAccounts(Collection $accounts): GroupCollectorInterface;
/**
* Limit the result to a specific transaction group.
*
* @param TransactionGroup $transactionGroup
*
* @return GroupCollectorInterface
*/
public function setGroup(TransactionGroup $transactionGroup): GroupCollectorInterface;
/**
* Limit the result to a set of specific transaction journals.
*

View File

@@ -111,7 +111,7 @@ class AvailableBudgetController extends Controller
*/
public function createAlternative(Request $request, Carbon $start, Carbon $end)
{
$currencies = $this->currencyRepos->getEnabled();
$currencies = $this->currencyRepos->get();
$availableBudgets = $this->abRepository->get($start, $end);
// remove already budgeted currencies:

View File

@@ -86,7 +86,7 @@ class BudgetLimitController extends Controller
*/
public function create(Budget $budget, Carbon $start, Carbon $end)
{
$collection = $this->currencyRepos->getEnabled();
$collection = $this->currencyRepos->get();
$budgetLimits = $this->blRepository->getBudgetLimits($budget, $start, $end);
// remove already budgeted currencies:

View File

@@ -99,7 +99,7 @@ class IndexController extends Controller
$start = $start ?? session('start', Carbon::now()->startOfMonth());
$end = $end ?? app('navigation')->endOfPeriod($start, $range);
$defaultCurrency = app('amount')->getDefaultCurrency();
$currencies = $this->currencyRepository->getEnabled();
$currencies = $this->currencyRepository->get();
$budgeted = '0';
$spent = '0';

View File

@@ -55,7 +55,6 @@ class StartFireflySession extends StartSession
&& 'GET' === $request->method()
&& !$request->ajax()) {
$session->setPreviousUrl($uri);
return;
}
}
}

View File

@@ -401,14 +401,6 @@ class CurrencyRepository implements CurrencyRepositoryInterface
return $preferred;
}
/**
* @return Collection
*/
public function getEnabled(): Collection
{
return TransactionCurrency::where('enabled', true)->orderBy('code', 'ASC')->get();
}
/**
* Get currency exchange rate.
*

View File

@@ -203,11 +203,6 @@ interface CurrencyRepositoryInterface
*/
public function getCurrencyByPreference(Preference $preference): TransactionCurrency;
/**
* @return Collection
*/
public function getEnabled(): Collection;
/**
* Get currency exchange rate.
*

View File

@@ -72,41 +72,6 @@ class AccountForm
return $grouped;
}
/**
* Shows a <select> with all active asset accounts.
*
* @param string $name
* @param mixed $value
* @param array $options
*
* @return string
*/
public function activeAssetAccountList(string $name, $value = null, array $options = null): string
{
$types = [AccountType::ASSET, AccountType::DEFAULT];
$grouped = $this->getAccountsGrouped($types);
return $this->select($name, $grouped, $value, $options);
}
/**
* Return a list that includes liabilities.
*
* @param string $name
* @param mixed $value
* @param array $options
*
* @return string
*/
public function activeLongAccountList(string $name, $value = null, array $options = null): string
{
$types = [AccountType::ASSET, AccountType::DEFAULT, AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN,];
$grouped = $this->getAccountsGrouped($types);
return $this->select($name, $grouped, $value, $options);
}
/**
* Grouped dropdown list of all accounts that are valid as the destination of a withdrawal.
*