mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-20 00:20:03 +00:00
Code cleanup.
This commit is contained in:
@@ -40,22 +40,18 @@ use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Trait AugumentData
|
||||
*
|
||||
*/
|
||||
trait AugumentData
|
||||
{
|
||||
/**
|
||||
* Searches for the opposing account.
|
||||
*
|
||||
* @param Collection $accounts
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function combineAccounts(Collection $accounts): array // filter + group data
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$combined = [];
|
||||
|
||||
/** @var Account $expenseAccount */
|
||||
foreach ($accounts as $expenseAccount) {
|
||||
$collection = new Collection();
|
||||
@@ -73,10 +69,6 @@ trait AugumentData
|
||||
|
||||
/**
|
||||
* Small helper function for the revenue and expense account charts.
|
||||
*
|
||||
* @param array $names
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function expandNames(array $names): array
|
||||
{
|
||||
@@ -90,14 +82,11 @@ trait AugumentData
|
||||
|
||||
/**
|
||||
* Small helper function for the revenue and expense account charts.
|
||||
*
|
||||
* @param Collection $accounts
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function extractNames(Collection $accounts): array
|
||||
{
|
||||
$return = [];
|
||||
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
$return[$account->id] = $account->name;
|
||||
@@ -108,10 +97,6 @@ trait AugumentData
|
||||
|
||||
/**
|
||||
* Get the account names belonging to a bunch of account ID's.
|
||||
*
|
||||
* @param array $accountIds
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getAccountNames(array $accountIds): array // extract info from array.
|
||||
{
|
||||
@@ -134,10 +119,6 @@ trait AugumentData
|
||||
|
||||
/**
|
||||
* Get the budget names from a set of budget ID's.
|
||||
*
|
||||
* @param array $budgetIds
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getBudgetNames(array $budgetIds): array // extract info from array.
|
||||
{
|
||||
@@ -158,10 +139,6 @@ trait AugumentData
|
||||
|
||||
/**
|
||||
* Get the category names from a set of category ID's. Small helper function for some of the charts.
|
||||
*
|
||||
* @param array $categoryIds
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getCategoryNames(array $categoryIds): array // extract info from array.
|
||||
{
|
||||
@@ -184,12 +161,6 @@ trait AugumentData
|
||||
|
||||
/**
|
||||
* Gets all budget limits for a budget.
|
||||
*
|
||||
* @param Budget $budget
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
protected function getLimits(Budget $budget, Carbon $start, Carbon $end): Collection // get data + augment with info
|
||||
{
|
||||
@@ -243,15 +214,12 @@ trait AugumentData
|
||||
|
||||
/**
|
||||
* Group set of transactions by name of opposing account.
|
||||
*
|
||||
* @param array $array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function groupByName(array $array): array // filter + group data
|
||||
{
|
||||
// group by opposing account name.
|
||||
$grouped = [];
|
||||
|
||||
/** @var array $journal */
|
||||
foreach ($array as $journal) {
|
||||
$name = '(no name)';
|
||||
@@ -271,13 +239,6 @@ trait AugumentData
|
||||
|
||||
/**
|
||||
* Spent in a period.
|
||||
*
|
||||
* @param Collection $assets
|
||||
* @param Collection $opposing
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function spentInPeriod(Collection $assets, Collection $opposing, Carbon $start, Carbon $end): array // get data + augment with info
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user