diff --git a/app/Generator/Report/Account/MonthReportGenerator.php b/app/Generator/Report/Account/MonthReportGenerator.php
index d3dc1e659d..49f0cbfbd7 100644
--- a/app/Generator/Report/Account/MonthReportGenerator.php
+++ b/app/Generator/Report/Account/MonthReportGenerator.php
@@ -31,17 +31,20 @@ use Illuminate\Support\Collection;
*/
class MonthReportGenerator implements ReportGeneratorInterface
{
- /** @var Collection */
+ /** @var Collection The accounts involved in the report. */
private $accounts;
- /** @var Carbon */
+ /** @var Carbon The end date */
private $end;
- /** @var Collection */
+ /** @var Collection The expense accounts. */
private $expense;
- /** @var Carbon */
+ /** @var Carbon The start date. */
private $start;
/**
+ * Generate the report.
+ *
* @return string
+ * @throws \Throwable
*/
public function generate(): string
{
@@ -57,6 +60,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Set accounts.
+ *
* @param Collection $accounts
*
* @return ReportGeneratorInterface
@@ -69,6 +74,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Set budgets.
+ *
* @param Collection $budgets
*
* @return ReportGeneratorInterface
@@ -79,6 +86,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Set categories.
+ *
* @param Collection $categories
*
* @return ReportGeneratorInterface
@@ -89,6 +98,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Set end date.
+ *
* @param Carbon $date
*
* @return ReportGeneratorInterface
@@ -101,6 +112,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Set expense collection.
+ *
* @param Collection $expense
*
* @return ReportGeneratorInterface
@@ -113,6 +126,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Set start date.
+ *
* @param Carbon $date
*
* @return ReportGeneratorInterface
@@ -125,6 +140,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Set collection of tags.
+ *
* @param Collection $tags
*
* @return ReportGeneratorInterface
@@ -135,6 +152,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Return the preferred period.
+ *
* @return string
*/
protected function preferredPeriod(): string
diff --git a/app/Generator/Report/Account/MultiYearReportGenerator.php b/app/Generator/Report/Account/MultiYearReportGenerator.php
index 690891b8e1..a4d17d0d83 100644
--- a/app/Generator/Report/Account/MultiYearReportGenerator.php
+++ b/app/Generator/Report/Account/MultiYearReportGenerator.php
@@ -27,9 +27,9 @@ namespace FireflyIII\Generator\Report\Account;
*/
class MultiYearReportGenerator extends MonthReportGenerator
{
- // Doesn't do anything different.
-
/**
+ * Returns the preferred period.
+ *
* @return string
*/
protected function preferredPeriod(): string
diff --git a/app/Generator/Report/Account/YearReportGenerator.php b/app/Generator/Report/Account/YearReportGenerator.php
index f5031da9e2..c1e890ba19 100644
--- a/app/Generator/Report/Account/YearReportGenerator.php
+++ b/app/Generator/Report/Account/YearReportGenerator.php
@@ -27,9 +27,9 @@ namespace FireflyIII\Generator\Report\Account;
*/
class YearReportGenerator extends MonthReportGenerator
{
- // Doesn't do anything different.
-
/**
+ * Returns the preferred period.
+ *
* @return string
*/
protected function preferredPeriod(): string
diff --git a/app/Generator/Report/Audit/MonthReportGenerator.php b/app/Generator/Report/Audit/MonthReportGenerator.php
index a4acdfcb24..c8029453e0 100644
--- a/app/Generator/Report/Audit/MonthReportGenerator.php
+++ b/app/Generator/Report/Audit/MonthReportGenerator.php
@@ -18,15 +18,20 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see .
*/
+
+/** @noinspection PhpUndefinedMethodInspection */
+
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Audit;
use Carbon\Carbon;
+use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Models\Account;
use FireflyIII\Models\Transaction;
+use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use Illuminate\Support\Collection;
use Steam;
@@ -36,15 +41,18 @@ use Steam;
*/
class MonthReportGenerator implements ReportGeneratorInterface
{
- /** @var Collection */
+ /** @var Collection The accounts used. */
private $accounts;
- /** @var Carbon */
+ /** @var Carbon End date of the report. */
private $end;
- /** @var Carbon */
+ /** @var Carbon Start date of the report. */
private $start;
/**
+ * Generates the report.
+ *
* @return string
+ * @throws \Throwable
*/
public function generate(): string
{
@@ -77,6 +85,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Account collection setter.
+ *
* @param Collection $accounts
*
* @return ReportGeneratorInterface
@@ -89,6 +99,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Budget collection setter.
+ *
* @param Collection $budgets
*
* @return ReportGeneratorInterface
@@ -99,6 +111,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Category collection setter.
+ *
* @param Collection $categories
*
* @return ReportGeneratorInterface
@@ -109,6 +123,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * End date setter.
+ *
* @param Carbon $date
*
* @return ReportGeneratorInterface
@@ -121,6 +137,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Expenses collection setter.
+ *
* @param Collection $expense
*
* @return ReportGeneratorInterface
@@ -131,6 +149,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Start date collection setter.
+ *
* @param Carbon $date
*
* @return ReportGeneratorInterface
@@ -143,6 +163,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Tags collection setter.
+ *
* @param Collection $tags
*
* @return ReportGeneratorInterface
@@ -153,18 +175,25 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Get the audit report.
+ *
* @param Account $account
* @param Carbon $date
*
* @return array
*
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) // not that long
+ * @throws FireflyException
*/
private function getAuditReport(Account $account, Carbon $date): array
{
/** @var CurrencyRepositoryInterface $currencyRepos */
$currencyRepos = app(CurrencyRepositoryInterface::class);
+ /** @var AccountRepositoryInterface $accountRepository */
+ $accountRepository = app(AccountRepositoryInterface::class);
+ $accountRepository->setUser($account->user);
+
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))->setRange($this->start, $this->end);
@@ -172,7 +201,11 @@ class MonthReportGenerator implements ReportGeneratorInterface
$journals = $journals->reverse();
$dayBeforeBalance = Steam::balance($account, $date);
$startBalance = $dayBeforeBalance;
- $currency = $currencyRepos->find((int)$account->getMeta('currency_id'));
+ $currency = $currencyRepos->findNull((int)$accountRepository->getMetaValue($account, 'currency_id'));
+
+ if (null === $currency) {
+ throw new FireflyException('Unexpected NULL value in account currency preference.');
+ }
/** @var Transaction $transaction */
foreach ($journals as $transaction) {
@@ -186,7 +219,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
$newBalance = bcadd($startBalance, $transactionAmount);
$transaction->after = $newBalance;
$startBalance = $newBalance;
- $transaction->currency = $currency;
}
$return = [
diff --git a/app/Generator/Report/Audit/MultiYearReportGenerator.php b/app/Generator/Report/Audit/MultiYearReportGenerator.php
index 00df62d2db..0bd3b5697f 100644
--- a/app/Generator/Report/Audit/MultiYearReportGenerator.php
+++ b/app/Generator/Report/Audit/MultiYearReportGenerator.php
@@ -27,5 +27,4 @@ namespace FireflyIII\Generator\Report\Audit;
*/
class MultiYearReportGenerator extends MonthReportGenerator
{
- // Doesn't do anything different.
}
diff --git a/app/Generator/Report/Audit/YearReportGenerator.php b/app/Generator/Report/Audit/YearReportGenerator.php
index 4855e6aeee..e341718728 100644
--- a/app/Generator/Report/Audit/YearReportGenerator.php
+++ b/app/Generator/Report/Audit/YearReportGenerator.php
@@ -27,5 +27,4 @@ namespace FireflyIII\Generator\Report\Audit;
*/
class YearReportGenerator extends MonthReportGenerator
{
- // Doesn't do anything different.
}
diff --git a/app/Generator/Report/Budget/MonthReportGenerator.php b/app/Generator/Report/Budget/MonthReportGenerator.php
index d5e0a8a9a0..ff4229ab26 100644
--- a/app/Generator/Report/Budget/MonthReportGenerator.php
+++ b/app/Generator/Report/Budget/MonthReportGenerator.php
@@ -18,6 +18,8 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see .
*/
+/** @noinspection MultipleReturnStatementsInspection */
+/** @noinspection PhpUndefinedMethodInspection */
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Budget;
@@ -39,17 +41,15 @@ use Log;
*/
class MonthReportGenerator extends Support implements ReportGeneratorInterface
{
- /** @var Collection */
+ /** @var Collection The accounts in the report. */
private $accounts;
- /** @var Collection */
+ /** @var Collection The budgets in the report. */
private $budgets;
- /** @var Carbon */
+ /** @var Carbon The end date. */
private $end;
- /** @var Collection */
+ /** @var Collection The expenses in the report. */
private $expenses;
- /** @var Collection */
- private $income;
- /** @var Carbon */
+ /** @var Carbon The start date. */
private $start;
/**
@@ -57,12 +57,14 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
*/
public function __construct()
{
- $this->income = new Collection;
$this->expenses = new Collection;
}
/**
+ * Generates the report.
+ *
* @return string
+ * @throws \Throwable
*/
public function generate(): string
{
@@ -83,6 +85,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Set the involved accounts.
+ *
* @param Collection $accounts
*
* @return ReportGeneratorInterface
@@ -95,6 +99,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Set the involved budgets.
+ *
* @param Collection $budgets
*
* @return ReportGeneratorInterface
@@ -107,6 +113,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Unused category setter.
+ *
* @param Collection $categories
*
* @return ReportGeneratorInterface
@@ -117,6 +125,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Set the end date of the report.
+ *
* @param Carbon $date
*
* @return ReportGeneratorInterface
@@ -129,6 +139,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Unused expense setter.
+ *
* @param Collection $expense
*
* @return ReportGeneratorInterface
@@ -139,6 +151,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Set the start date of the report.
+ *
* @param Carbon $date
*
* @return ReportGeneratorInterface
@@ -151,6 +165,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Unused tags setter.
+ *
* @param Collection $tags
*
* @return ReportGeneratorInterface
@@ -161,6 +177,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Get the expenses.
+ *
* @return Collection
*/
protected function getExpenses(): Collection
@@ -188,6 +206,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Summarize a collection by its budget.
+ *
* @param Collection $collection
*
* @return array
diff --git a/app/Generator/Report/Budget/MultiYearReportGenerator.php b/app/Generator/Report/Budget/MultiYearReportGenerator.php
index 13e4fc81b0..1e32b8d8ce 100644
--- a/app/Generator/Report/Budget/MultiYearReportGenerator.php
+++ b/app/Generator/Report/Budget/MultiYearReportGenerator.php
@@ -27,5 +27,4 @@ namespace FireflyIII\Generator\Report\Budget;
*/
class MultiYearReportGenerator extends MonthReportGenerator
{
- // Doesn't do anything different.
}
diff --git a/app/Generator/Report/Budget/YearReportGenerator.php b/app/Generator/Report/Budget/YearReportGenerator.php
index 44ff2349b1..a025513451 100644
--- a/app/Generator/Report/Budget/YearReportGenerator.php
+++ b/app/Generator/Report/Budget/YearReportGenerator.php
@@ -27,5 +27,4 @@ namespace FireflyIII\Generator\Report\Budget;
*/
class YearReportGenerator extends MonthReportGenerator
{
- // Doesn't do anything different.
}
diff --git a/app/Generator/Report/Category/MonthReportGenerator.php b/app/Generator/Report/Category/MonthReportGenerator.php
index 31ca187d53..ef187a575b 100644
--- a/app/Generator/Report/Category/MonthReportGenerator.php
+++ b/app/Generator/Report/Category/MonthReportGenerator.php
@@ -18,6 +18,8 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see .
*/
+/** @noinspection MultipleReturnStatementsInspection */
+/** @noinspection PhpUndefinedMethodInspection */
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Category;
@@ -40,17 +42,17 @@ use Log;
*/
class MonthReportGenerator extends Support implements ReportGeneratorInterface
{
- /** @var Collection */
+ /** @var Collection The included accounts */
private $accounts;
- /** @var Collection */
+ /** @var Collection The included categories */
private $categories;
- /** @var Carbon */
+ /** @var Carbon The end date */
private $end;
- /** @var Collection */
+ /** @var Collection The expenses */
private $expenses;
- /** @var Collection */
+ /** @var Collection The income in the report. */
private $income;
- /** @var Carbon */
+ /** @var Carbon The start date. */
private $start;
/**
@@ -63,7 +65,10 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Generates the report.
+ *
* @return string
+ * @throws \Throwable
*/
public function generate(): string
{
@@ -101,6 +106,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Set the involved accounts.
+ *
* @param Collection $accounts
*
* @return ReportGeneratorInterface
@@ -113,6 +120,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Empty budget setter.
+ *
* @param Collection $budgets
*
* @return ReportGeneratorInterface
@@ -123,6 +132,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Set the categories involved in this report.
+ *
* @param Collection $categories
*
* @return ReportGeneratorInterface
@@ -135,6 +146,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Set the end date for this report.
+ *
* @param Carbon $date
*
* @return ReportGeneratorInterface
@@ -147,6 +160,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Set the expenses involved in this report.
+ *
* @param Collection $expense
*
* @return ReportGeneratorInterface
@@ -157,6 +172,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Set the start date for this report.
+ *
* @param Carbon $date
*
* @return ReportGeneratorInterface
@@ -169,6 +186,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Unused tag setter.
+ *
* @param Collection $tags
*
* @return ReportGeneratorInterface
@@ -179,6 +198,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Get the expenses for this report.
+ *
* @return Collection
*/
protected function getExpenses(): Collection
@@ -206,6 +227,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Get the income for this report.
+ *
* @return Collection
*/
protected function getIncome(): Collection
@@ -230,6 +253,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Summarize the category.
+ *
* @param Collection $collection
*
* @return array
diff --git a/app/Generator/Report/Category/MultiYearReportGenerator.php b/app/Generator/Report/Category/MultiYearReportGenerator.php
index 1ce99f992f..2fe96eb9cd 100644
--- a/app/Generator/Report/Category/MultiYearReportGenerator.php
+++ b/app/Generator/Report/Category/MultiYearReportGenerator.php
@@ -27,5 +27,4 @@ namespace FireflyIII\Generator\Report\Category;
*/
class MultiYearReportGenerator extends MonthReportGenerator
{
- // Doesn't do anything different.
}
diff --git a/app/Generator/Report/Category/YearReportGenerator.php b/app/Generator/Report/Category/YearReportGenerator.php
index d769979990..920ea366e7 100644
--- a/app/Generator/Report/Category/YearReportGenerator.php
+++ b/app/Generator/Report/Category/YearReportGenerator.php
@@ -27,5 +27,4 @@ namespace FireflyIII\Generator\Report\Category;
*/
class YearReportGenerator extends MonthReportGenerator
{
- // Doesn't do anything different.
}
diff --git a/app/Generator/Report/ReportGeneratorFactory.php b/app/Generator/Report/ReportGeneratorFactory.php
index e06cb5b3ac..6e06480a33 100644
--- a/app/Generator/Report/ReportGeneratorFactory.php
+++ b/app/Generator/Report/ReportGeneratorFactory.php
@@ -31,6 +31,8 @@ use FireflyIII\Exceptions\FireflyException;
class ReportGeneratorFactory
{
/**
+ * Static report generator class.
+ *
* @param string $type
* @param Carbon $start
* @param Carbon $end
diff --git a/app/Generator/Report/ReportGeneratorInterface.php b/app/Generator/Report/ReportGeneratorInterface.php
index 42d1d158b2..db0369ce17 100644
--- a/app/Generator/Report/ReportGeneratorInterface.php
+++ b/app/Generator/Report/ReportGeneratorInterface.php
@@ -31,11 +31,15 @@ use Illuminate\Support\Collection;
interface ReportGeneratorInterface
{
/**
+ * Generate the report.
+ *
* @return string
*/
public function generate(): string;
/**
+ * Set the involved accounts.
+ *
* @param Collection $accounts
*
* @return ReportGeneratorInterface
@@ -43,6 +47,8 @@ interface ReportGeneratorInterface
public function setAccounts(Collection $accounts): ReportGeneratorInterface;
/**
+ * Set the involved budgets.
+ *
* @param Collection $budgets
*
* @return ReportGeneratorInterface
@@ -50,6 +56,8 @@ interface ReportGeneratorInterface
public function setBudgets(Collection $budgets): ReportGeneratorInterface;
/**
+ * Set the involved categories.
+ *
* @param Collection $categories
*
* @return ReportGeneratorInterface
@@ -57,6 +65,8 @@ interface ReportGeneratorInterface
public function setCategories(Collection $categories): ReportGeneratorInterface;
/**
+ * Set the end date.
+ *
* @param Carbon $date
*
* @return ReportGeneratorInterface
@@ -64,6 +74,8 @@ interface ReportGeneratorInterface
public function setEndDate(Carbon $date): ReportGeneratorInterface;
/**
+ * Set the expense accounts.
+ *
* @param Collection $expense
*
* @return ReportGeneratorInterface
@@ -71,6 +83,8 @@ interface ReportGeneratorInterface
public function setExpense(Collection $expense): ReportGeneratorInterface;
/**
+ * Set the start date.
+ *
* @param Carbon $date
*
* @return ReportGeneratorInterface
@@ -78,6 +92,8 @@ interface ReportGeneratorInterface
public function setStartDate(Carbon $date): ReportGeneratorInterface;
/**
+ * Set the tags.
+ *
* @param Collection $tags
*
* @return ReportGeneratorInterface
diff --git a/app/Generator/Report/Standard/MonthReportGenerator.php b/app/Generator/Report/Standard/MonthReportGenerator.php
index 348efb6975..e27f4d79ed 100644
--- a/app/Generator/Report/Standard/MonthReportGenerator.php
+++ b/app/Generator/Report/Standard/MonthReportGenerator.php
@@ -32,15 +32,18 @@ use Illuminate\Support\Collection;
*/
class MonthReportGenerator implements ReportGeneratorInterface
{
- /** @var Collection */
+ /** @var Collection The accounts involved in the report. */
private $accounts;
- /** @var Carbon */
+ /** @var Carbon The end date. */
private $end;
- /** @var Carbon */
+ /** @var Carbon The start date. */
private $start;
/**
+ * Generates the report.
+ *
* @return string
+ * @throws \Throwable
*/
public function generate(): string
{
@@ -58,6 +61,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Sets the accounts involved in the report.
+ *
* @param Collection $accounts
*
* @return ReportGeneratorInterface
@@ -70,6 +75,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Unused budget setter.
+ *
* @param Collection $budgets
*
* @return ReportGeneratorInterface
@@ -80,6 +87,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Unused category setter.
+ *
* @param Collection $categories
*
* @return ReportGeneratorInterface
@@ -90,6 +99,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Set the end date of the report.
+ *
* @param Carbon $date
*
* @return ReportGeneratorInterface
@@ -102,6 +113,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Set the expenses used in this report.
+ *
* @param Collection $expense
*
* @return ReportGeneratorInterface
@@ -112,6 +125,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Set the start date of this report.
+ *
* @param Carbon $date
*
* @return ReportGeneratorInterface
@@ -124,6 +139,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/**
+ * Set the tags used in this report.
+ *
* @param Collection $tags
*
* @return ReportGeneratorInterface
diff --git a/app/Generator/Report/Standard/MultiYearReportGenerator.php b/app/Generator/Report/Standard/MultiYearReportGenerator.php
index d03465386e..ec507b9386 100644
--- a/app/Generator/Report/Standard/MultiYearReportGenerator.php
+++ b/app/Generator/Report/Standard/MultiYearReportGenerator.php
@@ -31,15 +31,18 @@ use Illuminate\Support\Collection;
*/
class MultiYearReportGenerator implements ReportGeneratorInterface
{
- /** @var Collection */
+ /** @var Collection The accounts involved. */
private $accounts;
- /** @var Carbon */
+ /** @var Carbon The end date. */
private $end;
- /** @var Carbon */
+ /** @var Carbon The start date. */
private $start;
/**
+ * Generates the report.
+ *
* @return string
+ * @throws \Throwable
*/
public function generate(): string
{
@@ -55,6 +58,8 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
}
/**
+ * Sets the accounts used in the report.
+ *
* @param Collection $accounts
*
* @return ReportGeneratorInterface
@@ -67,6 +72,8 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
}
/**
+ * Sets the budgets used in the report.
+ *
* @param Collection $budgets
*
* @return ReportGeneratorInterface
@@ -77,6 +84,8 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
}
/**
+ * Sets the categories used in the report.
+ *
* @param Collection $categories
*
* @return ReportGeneratorInterface
@@ -87,6 +96,8 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
}
/**
+ * Sets the end date used in the report.
+ *
* @param Carbon $date
*
* @return ReportGeneratorInterface
@@ -99,6 +110,8 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
}
/**
+ * Unused setter for expenses.
+ *
* @param Collection $expense
*
* @return ReportGeneratorInterface
@@ -109,6 +122,8 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
}
/**
+ * Set the start date of the report.
+ *
* @param Carbon $date
*
* @return ReportGeneratorInterface
@@ -121,6 +136,8 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
}
/**
+ * Set the tags for the report.
+ *
* @param Collection $tags
*
* @return ReportGeneratorInterface
diff --git a/app/Generator/Report/Standard/YearReportGenerator.php b/app/Generator/Report/Standard/YearReportGenerator.php
index 900758a1ca..47f92f47ad 100644
--- a/app/Generator/Report/Standard/YearReportGenerator.php
+++ b/app/Generator/Report/Standard/YearReportGenerator.php
@@ -31,15 +31,18 @@ use Illuminate\Support\Collection;
*/
class YearReportGenerator implements ReportGeneratorInterface
{
- /** @var Collection */
+ /** @var Collection The accounts involved. */
private $accounts;
- /** @var Carbon */
+ /** @var Carbon The end date. */
private $end;
- /** @var Carbon */
+ /** @var Carbon The start date. */
private $start;
/**
+ * Generates the report.
+ *
* @return string
+ * @throws \Throwable
*/
public function generate(): string
{
@@ -55,6 +58,8 @@ class YearReportGenerator implements ReportGeneratorInterface
}
/**
+ * Set the accounts.
+ *
* @param Collection $accounts
*
* @return ReportGeneratorInterface
@@ -67,6 +72,8 @@ class YearReportGenerator implements ReportGeneratorInterface
}
/**
+ * Unused budget setter.
+ *
* @param Collection $budgets
*
* @return ReportGeneratorInterface
@@ -77,6 +84,8 @@ class YearReportGenerator implements ReportGeneratorInterface
}
/**
+ * Unused categories setter.
+ *
* @param Collection $categories
*
* @return ReportGeneratorInterface
@@ -87,6 +96,8 @@ class YearReportGenerator implements ReportGeneratorInterface
}
/**
+ * Set the end date.
+ *
* @param Carbon $date
*
* @return ReportGeneratorInterface
@@ -99,6 +110,8 @@ class YearReportGenerator implements ReportGeneratorInterface
}
/**
+ * Set the expenses used.
+ *
* @param Collection $expense
*
* @return ReportGeneratorInterface
@@ -109,6 +122,8 @@ class YearReportGenerator implements ReportGeneratorInterface
}
/**
+ * Set the start date.
+ *
* @param Carbon $date
*
* @return ReportGeneratorInterface
@@ -121,6 +136,8 @@ class YearReportGenerator implements ReportGeneratorInterface
}
/**
+ * Unused tags setter.
+ *
* @param Collection $tags
*
* @return ReportGeneratorInterface
diff --git a/app/Generator/Report/Support.php b/app/Generator/Report/Support.php
index f739509769..f3d757e63d 100644
--- a/app/Generator/Report/Support.php
+++ b/app/Generator/Report/Support.php
@@ -18,6 +18,8 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see .
*/
+/** @noinspection PhpUndefinedMethodInspection */
+/** @noinspection PhpUndefinedMethodInspection */
declare(strict_types=1);
namespace FireflyIII\Generator\Report;
@@ -31,6 +33,8 @@ use Illuminate\Support\Collection;
class Support
{
/**
+ * Get the top expenses.
+ *
* @return Collection
*/
public function getTopExpenses(): Collection
@@ -39,6 +43,8 @@ class Support
}
/**
+ * Get the top income.
+ *
* @return Collection
*/
public function getTopIncome(): Collection
@@ -47,6 +53,8 @@ class Support
}
/**
+ * Get averages from a collection.
+ *
* @param Collection $collection
* @param int $sortFlag
*
@@ -89,6 +97,8 @@ class Support
}
/**
+ * Summarize collection by earned and spent data.
+ *
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly five.
*
* @param array $spent
@@ -117,7 +127,6 @@ class Support
$return[$objectId]['spent'] = $entry;
$return['sum']['spent'] = bcadd($return['sum']['spent'], $entry);
}
- unset($entry);
/**
* @var int
@@ -136,6 +145,8 @@ class Support
}
/**
+ * Summarize the data by account.
+ *
* @param Collection $collection
*
* @return array
diff --git a/app/Generator/Report/Tag/MonthReportGenerator.php b/app/Generator/Report/Tag/MonthReportGenerator.php
index 678339cc12..1c5affa011 100644
--- a/app/Generator/Report/Tag/MonthReportGenerator.php
+++ b/app/Generator/Report/Tag/MonthReportGenerator.php
@@ -18,6 +18,9 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see .
*/
+
+/** @noinspection MultipleReturnStatementsInspection */
+/** @noinspection PhpUndefinedMethodInspection */
declare(strict_types=1);
namespace FireflyIII\Generator\Report\Tag;
@@ -41,17 +44,17 @@ use Log;
*/
class MonthReportGenerator extends Support implements ReportGeneratorInterface
{
- /** @var Collection */
+ /** @var Collection The accounts involved */
private $accounts;
- /** @var Carbon */
+ /** @var Carbon The end date */
private $end;
- /** @var Collection */
+ /** @var Collection The expenses involved */
private $expenses;
- /** @var Collection */
+ /** @var Collection The income involved */
private $income;
- /** @var Carbon */
+ /** @var Carbon The start date */
private $start;
- /** @var Collection */
+ /** @var Collection The tags involved. */
private $tags;
/**
@@ -64,7 +67,11 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Generate the report.
+ *
* @return string
+ * @throws \Throwable
+ * @throws \Throwable
*/
public function generate(): string
{
@@ -98,6 +105,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Set the accounts.
+ *
* @param Collection $accounts
*
* @return ReportGeneratorInterface
@@ -110,6 +119,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Unused budget setter.
+ *
* @param Collection $budgets
*
* @return ReportGeneratorInterface
@@ -120,6 +131,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Unused category setter.
+ *
* @param Collection $categories
*
* @return ReportGeneratorInterface
@@ -130,6 +143,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Set the end date of the report.
+ *
* @param Carbon $date
*
* @return ReportGeneratorInterface
@@ -142,6 +157,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Set the expenses in this report.
+ *
* @param Collection $expense
*
* @return ReportGeneratorInterface
@@ -152,6 +169,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Set the start date.
+ *
* @param Carbon $date
*
* @return ReportGeneratorInterface
@@ -164,6 +183,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Set the tags used in this report.
+ *
* @param Collection $tags
*
* @return ReportGeneratorInterface
@@ -176,6 +197,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Get expense collection for report.
+ *
* @return Collection
*/
protected function getExpenses(): Collection
@@ -204,6 +227,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Get the income for this report.
+ *
* @return Collection
*/
protected function getIncome(): Collection
@@ -228,6 +253,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/**
+ * Summarize by tag.
+ *
* @param Collection $collection
*
* @return array
diff --git a/app/Generator/Report/Tag/MultiYearReportGenerator.php b/app/Generator/Report/Tag/MultiYearReportGenerator.php
index 1b5aa1993f..0d6380416b 100644
--- a/app/Generator/Report/Tag/MultiYearReportGenerator.php
+++ b/app/Generator/Report/Tag/MultiYearReportGenerator.php
@@ -27,5 +27,4 @@ namespace FireflyIII\Generator\Report\Tag;
*/
class MultiYearReportGenerator extends MonthReportGenerator
{
- // Doesn't do anything different.
}
diff --git a/app/Generator/Report/Tag/YearReportGenerator.php b/app/Generator/Report/Tag/YearReportGenerator.php
index abb8dc9efc..0cb3f216a0 100644
--- a/app/Generator/Report/Tag/YearReportGenerator.php
+++ b/app/Generator/Report/Tag/YearReportGenerator.php
@@ -27,5 +27,4 @@ namespace FireflyIII\Generator\Report\Tag;
*/
class YearReportGenerator extends MonthReportGenerator
{
- // Doesn't do anything different.
}
diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php
index 6237d5f0a0..4fd1f18d25 100644
--- a/app/Models/Transaction.php
+++ b/app/Models/Transaction.php
@@ -83,6 +83,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property TransactionCurrency $transactionCurrency
* @property int $transaction_journal_id
* @property TransactionCurrency $foreignCurrency
+ * @property string $before // used in audit reports.
+ * @property string $after // used in audit reports.
*/
class Transaction extends Model
{
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index 002209de96..45d4364e71 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -48,6 +48,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property int $transaction_type_id
* @property int transaction_currency_id
* @property TransactionCurrency $transactionCurrency
+ * @property Collection $tags
*/
class TransactionJournal extends Model
{