Various PSR12 code cleanup

This commit is contained in:
James Cole
2022-12-29 19:41:57 +01:00
parent 0022009dd5
commit dbf3e76ecc
340 changed files with 4079 additions and 3816 deletions

View File

@@ -1,4 +1,5 @@
<?php
/**
* MonthReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org
@@ -43,8 +44,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Generate the report.
* @throws FireflyException
* @return string
* @throws FireflyException
*/
public function generate(): string
{
@@ -80,7 +81,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set accounts.
*
* @param Collection $accounts
* @param Collection $accounts
*
* @return ReportGeneratorInterface
*/
@@ -94,7 +95,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set budgets.
*
* @param Collection $budgets
* @param Collection $budgets
*
* @return ReportGeneratorInterface
*/
@@ -106,7 +107,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set categories.
*
* @param Collection $categories
* @param Collection $categories
*
* @return ReportGeneratorInterface
*/
@@ -118,7 +119,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set end date.
*
* @param Carbon $date
* @param Carbon $date
*
* @return ReportGeneratorInterface
*/
@@ -132,7 +133,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set expense collection.
*
* @param Collection $expense
* @param Collection $expense
*
* @return ReportGeneratorInterface
*/
@@ -146,7 +147,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set start date.
*
* @param Carbon $date
* @param Carbon $date
*
* @return ReportGeneratorInterface
*/
@@ -160,7 +161,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set collection of tags.
*
* @param Collection $tags
* @param Collection $tags
*
* @return ReportGeneratorInterface
*/

View File

@@ -1,4 +1,5 @@
<?php
/**
* MultiYearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php
/**
* YearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org

View File

@@ -67,16 +67,32 @@ class MonthReportGenerator implements ReportGeneratorInterface
$defaultShow = ['icon', 'description', 'balance_before', 'amount', 'balance_after', 'date', 'to'];
$reportType = 'audit';
$accountIds = implode(',', $this->accounts->pluck('id')->toArray());
$hideable = ['buttons', 'icon', 'description', 'balance_before', 'amount', 'balance_after', 'date',
$hideable = [
'buttons',
'icon',
'description',
'balance_before',
'amount',
'balance_after',
'date',
'from', 'to', 'budget', 'category', 'bill',
'from',
'to',
'budget',
'category',
'bill',
// more new optional fields
'create_date', 'update_date',
// more new optional fields
'create_date',
'update_date',
// date fields.
'interest_date', 'book_date', 'process_date',
'due_date', 'payment_date', 'invoice_date',
// date fields.
'interest_date',
'book_date',
'process_date',
'due_date',
'payment_date',
'invoice_date',
];
try {
$result = view('reports.audit.report', compact('reportType', 'accountIds', 'auditData', 'hideable', 'defaultShow'))
@@ -95,8 +111,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Get the audit report.
*
* @param Account $account
* @param Carbon $date
* @param Account $account
* @param Carbon $date
*
* @return array
* @throws FireflyException
@@ -157,9 +173,9 @@ class MonthReportGenerator implements ReportGeneratorInterface
'journals' => $journals,
'currency' => $currency,
'exists' => 0 !== count($journals),
'end' => $this->end->isoFormat((string) trans('config.month_and_day_moment_js', [], $locale)),
'end' => $this->end->isoFormat((string)trans('config.month_and_day_moment_js', [], $locale)),
'endBalance' => app('steam')->balance($account, $this->end),
'dayBefore' => $date->isoFormat((string) trans('config.month_and_day_moment_js', [], $locale)),
'dayBefore' => $date->isoFormat((string)trans('config.month_and_day_moment_js', [], $locale)),
'dayBeforeBalance' => $dayBeforeBalance,
];
}
@@ -167,7 +183,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Account collection setter.
*
* @param Collection $accounts
* @param Collection $accounts
*
* @return ReportGeneratorInterface
* @codeCoverageIgnore
@@ -182,7 +198,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Budget collection setter.
*
* @param Collection $budgets
* @param Collection $budgets
*
* @return ReportGeneratorInterface
* @codeCoverageIgnore
@@ -195,7 +211,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Category collection setter.
*
* @param Collection $categories
* @param Collection $categories
*
* @return ReportGeneratorInterface
* @codeCoverageIgnore
@@ -208,7 +224,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* End date setter.
*
* @param Carbon $date
* @param Carbon $date
*
* @return ReportGeneratorInterface
* @codeCoverageIgnore
@@ -223,7 +239,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Expenses collection setter.
*
* @param Collection $expense
* @param Collection $expense
*
* @return ReportGeneratorInterface
* @codeCoverageIgnore
@@ -237,7 +253,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Start date collection setter.
*
* @param Carbon $date
* @param Carbon $date
*
* @return ReportGeneratorInterface
* @codeCoverageIgnore
@@ -252,7 +268,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Tags collection setter.
*
* @param Collection $tags
* @param Collection $tags
*
* @return ReportGeneratorInterface
* @codeCoverageIgnore

View File

@@ -1,4 +1,5 @@
<?php
/**
* MultiYearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php
/**
* YearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php
/**
* MonthReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org
@@ -81,38 +82,10 @@ class MonthReportGenerator implements ReportGeneratorInterface
return $result;
}
/**
* Set the involved accounts.
*
* @param Collection $accounts
*
* @return ReportGeneratorInterface
*/
public function setAccounts(Collection $accounts): ReportGeneratorInterface
{
$this->accounts = $accounts;
return $this;
}
/**
* Set the involved budgets.
*
* @param Collection $budgets
*
* @return ReportGeneratorInterface
*/
public function setBudgets(Collection $budgets): ReportGeneratorInterface
{
$this->budgets = $budgets;
return $this;
}
/**
* Unused category setter.
*
* @param Collection $categories
* @param Collection $categories
*
* @return ReportGeneratorInterface
*/
@@ -124,7 +97,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set the end date of the report.
*
* @param Carbon $date
* @param Carbon $date
*
* @return ReportGeneratorInterface
*/
@@ -138,7 +111,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Unused expense setter.
*
* @param Collection $expense
* @param Collection $expense
*
* @return ReportGeneratorInterface
*/
@@ -150,7 +123,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set the start date of the report.
*
* @param Carbon $date
* @param Carbon $date
*
* @return ReportGeneratorInterface
*/
@@ -164,7 +137,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Unused tags setter.
*
* @param Collection $tags
* @param Collection $tags
*
* @return ReportGeneratorInterface
*/
@@ -199,4 +172,32 @@ class MonthReportGenerator implements ReportGeneratorInterface
return $journals;
}
/**
* Set the involved budgets.
*
* @param Collection $budgets
*
* @return ReportGeneratorInterface
*/
public function setBudgets(Collection $budgets): ReportGeneratorInterface
{
$this->budgets = $budgets;
return $this;
}
/**
* Set the involved accounts.
*
* @param Collection $accounts
*
* @return ReportGeneratorInterface
*/
public function setAccounts(Collection $accounts): ReportGeneratorInterface
{
$this->accounts = $accounts;
return $this;
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* MultiYearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php
/**
* YearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php
/**
* MonthReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org
@@ -89,24 +90,10 @@ class MonthReportGenerator implements ReportGeneratorInterface
return $result;
}
/**
* Set the involved accounts.
*
* @param Collection $accounts
*
* @return ReportGeneratorInterface
*/
public function setAccounts(Collection $accounts): ReportGeneratorInterface
{
$this->accounts = $accounts;
return $this;
}
/**
* Empty budget setter.
*
* @param Collection $budgets
* @param Collection $budgets
*
* @return ReportGeneratorInterface
*/
@@ -115,24 +102,10 @@ class MonthReportGenerator implements ReportGeneratorInterface
return $this;
}
/**
* Set the categories involved in this report.
*
* @param Collection $categories
*
* @return ReportGeneratorInterface
*/
public function setCategories(Collection $categories): ReportGeneratorInterface
{
$this->categories = $categories;
return $this;
}
/**
* Set the end date for this report.
*
* @param Carbon $date
* @param Carbon $date
*
* @return ReportGeneratorInterface
*/
@@ -146,7 +119,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set the expenses involved in this report.
*
* @param Collection $expense
* @param Collection $expense
*
* @return ReportGeneratorInterface
*/
@@ -158,7 +131,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set the start date for this report.
*
* @param Carbon $date
* @param Carbon $date
*
* @return ReportGeneratorInterface
*/
@@ -172,7 +145,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Unused tag setter.
*
* @param Collection $tags
* @param Collection $tags
*
* @return ReportGeneratorInterface
*/
@@ -206,6 +179,34 @@ class MonthReportGenerator implements ReportGeneratorInterface
return $transactions;
}
/**
* Set the categories involved in this report.
*
* @param Collection $categories
*
* @return ReportGeneratorInterface
*/
public function setCategories(Collection $categories): ReportGeneratorInterface
{
$this->categories = $categories;
return $this;
}
/**
* Set the involved accounts.
*
* @param Collection $accounts
*
* @return ReportGeneratorInterface
*/
public function setAccounts(Collection $accounts): ReportGeneratorInterface
{
$this->accounts = $accounts;
return $this;
}
/**
* Get the income for this report.
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* MultiYearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php
/**
* YearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php
/**
* ReportGeneratorFactory.php
* Copyright (c) 2019 james@firefly-iii.org
@@ -35,9 +36,9 @@ class ReportGeneratorFactory
/**
* Static report generator class.
*
* @param string $type
* @param Carbon $start
* @param Carbon $end
* @param string $type
* @param Carbon $start
* @param Carbon $end
*
* @return ReportGeneratorInterface
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* ReportGeneratorInterface.php
* Copyright (c) 2019 james@firefly-iii.org
@@ -40,7 +41,7 @@ interface ReportGeneratorInterface
/**
* Set the involved accounts.
*
* @param Collection $accounts
* @param Collection $accounts
*
* @return ReportGeneratorInterface
*/
@@ -49,7 +50,7 @@ interface ReportGeneratorInterface
/**
* Set the involved budgets.
*
* @param Collection $budgets
* @param Collection $budgets
*
* @return ReportGeneratorInterface
*/
@@ -58,7 +59,7 @@ interface ReportGeneratorInterface
/**
* Set the involved categories.
*
* @param Collection $categories
* @param Collection $categories
*
* @return ReportGeneratorInterface
*/
@@ -67,7 +68,7 @@ interface ReportGeneratorInterface
/**
* Set the end date.
*
* @param Carbon $date
* @param Carbon $date
*
* @return ReportGeneratorInterface
*/
@@ -76,7 +77,7 @@ interface ReportGeneratorInterface
/**
* Set the expense accounts.
*
* @param Collection $expense
* @param Collection $expense
*
* @return ReportGeneratorInterface
*/
@@ -85,7 +86,7 @@ interface ReportGeneratorInterface
/**
* Set the start date.
*
* @param Carbon $date
* @param Carbon $date
*
* @return ReportGeneratorInterface
*/
@@ -94,7 +95,7 @@ interface ReportGeneratorInterface
/**
* Set the tags.
*
* @param Collection $tags
* @param Collection $tags
*
* @return ReportGeneratorInterface
*/

View File

@@ -1,4 +1,5 @@
<?php
/**
* MonthReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org
@@ -67,7 +68,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Sets the accounts involved in the report.
*
* @param Collection $accounts
* @param Collection $accounts
*
* @return ReportGeneratorInterface
*/
@@ -81,7 +82,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Unused budget setter.
*
* @param Collection $budgets
* @param Collection $budgets
*
* @return ReportGeneratorInterface
*/
@@ -93,7 +94,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Unused category setter.
*
* @param Collection $categories
* @param Collection $categories
*
* @return ReportGeneratorInterface
*/
@@ -105,7 +106,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set the end date of the report.
*
* @param Carbon $date
* @param Carbon $date
*
* @return ReportGeneratorInterface
*/
@@ -119,7 +120,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set the expenses used in this report.
*
* @param Collection $expense
* @param Collection $expense
*
* @return ReportGeneratorInterface
*/
@@ -131,7 +132,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set the start date of this report.
*
* @param Carbon $date
* @param Carbon $date
*
* @return ReportGeneratorInterface
*/
@@ -145,7 +146,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set the tags used in this report.
*
* @param Collection $tags
* @param Collection $tags
*
* @return ReportGeneratorInterface
*/

View File

@@ -1,4 +1,5 @@
<?php
/**
* MultiYearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org
@@ -71,7 +72,7 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
/**
* Sets the accounts used in the report.
*
* @param Collection $accounts
* @param Collection $accounts
*
* @return ReportGeneratorInterface
*/
@@ -85,7 +86,7 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
/**
* Sets the budgets used in the report.
*
* @param Collection $budgets
* @param Collection $budgets
*
* @return ReportGeneratorInterface
*/
@@ -97,7 +98,7 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
/**
* Sets the categories used in the report.
*
* @param Collection $categories
* @param Collection $categories
*
* @return ReportGeneratorInterface
*/
@@ -109,7 +110,7 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
/**
* Sets the end date used in the report.
*
* @param Carbon $date
* @param Carbon $date
*
* @return ReportGeneratorInterface
*/
@@ -123,7 +124,7 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
/**
* Unused setter for expenses.
*
* @param Collection $expense
* @param Collection $expense
*
* @return ReportGeneratorInterface
*/
@@ -135,7 +136,7 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
/**
* Set the start date of the report.
*
* @param Carbon $date
* @param Carbon $date
*
* @return ReportGeneratorInterface
*/
@@ -149,7 +150,7 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
/**
* Set the tags for the report.
*
* @param Collection $tags
* @param Collection $tags
*
* @return ReportGeneratorInterface
*/

View File

@@ -1,4 +1,5 @@
<?php
/**
* YearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org
@@ -71,7 +72,7 @@ class YearReportGenerator implements ReportGeneratorInterface
/**
* Set the accounts.
*
* @param Collection $accounts
* @param Collection $accounts
*
* @return ReportGeneratorInterface
*/
@@ -85,7 +86,7 @@ class YearReportGenerator implements ReportGeneratorInterface
/**
* Unused budget setter.
*
* @param Collection $budgets
* @param Collection $budgets
*
* @return ReportGeneratorInterface
*/
@@ -97,7 +98,7 @@ class YearReportGenerator implements ReportGeneratorInterface
/**
* Unused categories setter.
*
* @param Collection $categories
* @param Collection $categories
*
* @return ReportGeneratorInterface
*/
@@ -109,7 +110,7 @@ class YearReportGenerator implements ReportGeneratorInterface
/**
* Set the end date.
*
* @param Carbon $date
* @param Carbon $date
*
* @return ReportGeneratorInterface
*/
@@ -123,7 +124,7 @@ class YearReportGenerator implements ReportGeneratorInterface
/**
* Set the expenses used.
*
* @param Collection $expense
* @param Collection $expense
*
* @return ReportGeneratorInterface
*/
@@ -135,7 +136,7 @@ class YearReportGenerator implements ReportGeneratorInterface
/**
* Set the start date.
*
* @param Carbon $date
* @param Carbon $date
*
* @return ReportGeneratorInterface
*/
@@ -149,7 +150,7 @@ class YearReportGenerator implements ReportGeneratorInterface
/**
* Unused tags setter.
*
* @param Collection $tags
* @param Collection $tags
*
* @return ReportGeneratorInterface
*/

View File

@@ -90,7 +90,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set the accounts.
*
* @param Collection $accounts
* @param Collection $accounts
*
* @return ReportGeneratorInterface
*/
@@ -104,7 +104,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Unused budget setter.
*
* @param Collection $budgets
* @param Collection $budgets
*
* @return ReportGeneratorInterface
*/
@@ -116,7 +116,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Unused category setter.
*
* @param Collection $categories
* @param Collection $categories
*
* @return ReportGeneratorInterface
*/
@@ -128,7 +128,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set the end date of the report.
*
* @param Carbon $date
* @param Carbon $date
*
* @return ReportGeneratorInterface
*/
@@ -142,7 +142,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set the expenses in this report.
*
* @param Collection $expense
* @param Collection $expense
*
* @return ReportGeneratorInterface
*/
@@ -154,7 +154,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set the start date.
*
* @param Carbon $date
* @param Carbon $date
*
* @return ReportGeneratorInterface
*/
@@ -168,7 +168,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
/**
* Set the tags used in this report.
*
* @param Collection $tags
* @param Collection $tags
*
* @return ReportGeneratorInterface
*/

View File

@@ -1,4 +1,5 @@
<?php
/**
* MultiYearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php
/**
* YearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org