chore: reformat code.

This commit is contained in:
James Cole
2023-06-21 12:34:58 +02:00
parent 8d87abde64
commit 3dcb35710b
799 changed files with 23319 additions and 22173 deletions

View File

@@ -43,9 +43,9 @@ class AccountTasker implements AccountTaskerInterface
private User $user;
/**
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return array
* @throws FireflyException
@@ -116,9 +116,9 @@ class AccountTasker implements AccountTaskerInterface
}
/**
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
*
* @return array
* @throws FireflyException
@@ -153,51 +153,7 @@ class AccountTasker implements AccountTaskerInterface
}
/**
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
*
* @return array
* @throws FireflyException
* @throws JsonException
*/
public function getIncomeReport(Carbon $start, Carbon $end, Collection $accounts): array
{
// get all incomes for the given accounts in the given period!
// also transfers!
// get all transactions:
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setDestinationAccounts($accounts)->setRange($start, $end);
$collector->excludeSourceAccounts($accounts);
$collector->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER])->withAccountInformation();
$report = $this->groupIncomeBySource($collector->getExtractedJournals());
// sort the result
// Obtain a list of columns
$sum = [];
foreach ($report['accounts'] as $accountId => $row) {
$sum[$accountId] = (float)$row['sum']; // intentional float
}
array_multisort($sum, SORT_DESC, $report['accounts']);
return $report;
}
/**
* @param User|Authenticatable|null $user
*/
public function setUser(User|Authenticatable|null $user): void
{
if (null !== $user) {
$this->user = $user;
}
}
/**
* @param array $array
* @param array $array
*
* @return array
* @throws FireflyException
@@ -260,7 +216,41 @@ class AccountTasker implements AccountTaskerInterface
}
/**
* @param array $array
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
*
* @return array
* @throws FireflyException
* @throws JsonException
*/
public function getIncomeReport(Carbon $start, Carbon $end, Collection $accounts): array
{
// get all incomes for the given accounts in the given period!
// also transfers!
// get all transactions:
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setDestinationAccounts($accounts)->setRange($start, $end);
$collector->excludeSourceAccounts($accounts);
$collector->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER])->withAccountInformation();
$report = $this->groupIncomeBySource($collector->getExtractedJournals());
// sort the result
// Obtain a list of columns
$sum = [];
foreach ($report['accounts'] as $accountId => $row) {
$sum[$accountId] = (float)$row['sum']; // intentional float
}
array_multisort($sum, SORT_DESC, $report['accounts']);
return $report;
}
/**
* @param array $array
*
* @return array
* @throws FireflyException
@@ -320,4 +310,14 @@ class AccountTasker implements AccountTaskerInterface
return $report;
}
/**
* @param User|Authenticatable|null $user
*/
public function setUser(User | Authenticatable | null $user): void
{
if (null !== $user) {
$this->user = $user;
}
}
}