mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Code cleanup.
This commit is contained in:
@@ -27,26 +27,24 @@ use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
*
|
||||
|
||||
*/
|
||||
class MonthReportGenerator implements ReportGeneratorInterface
|
||||
{
|
||||
/** @var Collection The accounts involved in the report. */
|
||||
private $accounts;
|
||||
|
||||
/** @var Carbon The end date. */
|
||||
private $end;
|
||||
|
||||
/** @var Carbon The start date. */
|
||||
private $start;
|
||||
|
||||
/**
|
||||
* Generates the report.
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function generate(): string
|
||||
@@ -56,20 +54,17 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
try {
|
||||
return view('reports.default.month', compact('accountIds', 'reportType'))->with('start', $this->start)->with('end', $this->end)->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
app('log')->error(sprintf('Cannot render reports.default.month: %s', $e->getMessage()));
|
||||
app('log')->error($e->getTraceAsString());
|
||||
$result = 'Could not render report view.';
|
||||
|
||||
throw new FireflyException($result, 0, $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the accounts involved in the report.
|
||||
*
|
||||
* @param Collection $accounts
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setAccounts(Collection $accounts): ReportGeneratorInterface
|
||||
{
|
||||
@@ -80,10 +75,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Unused budget setter.
|
||||
*
|
||||
* @param Collection $budgets
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setBudgets(Collection $budgets): ReportGeneratorInterface
|
||||
{
|
||||
@@ -92,10 +83,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Unused category setter.
|
||||
*
|
||||
* @param Collection $categories
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setCategories(Collection $categories): ReportGeneratorInterface
|
||||
{
|
||||
@@ -104,10 +91,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Set the end date of the report.
|
||||
*
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setEndDate(Carbon $date): ReportGeneratorInterface
|
||||
{
|
||||
@@ -118,10 +101,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Set the expenses used in this report.
|
||||
*
|
||||
* @param Collection $expense
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setExpense(Collection $expense): ReportGeneratorInterface
|
||||
{
|
||||
@@ -130,10 +109,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Set the start date of this report.
|
||||
*
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setStartDate(Carbon $date): ReportGeneratorInterface
|
||||
{
|
||||
@@ -144,10 +119,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Set the tags used in this report.
|
||||
*
|
||||
* @param Collection $tags
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setTags(Collection $tags): ReportGeneratorInterface
|
||||
{
|
||||
|
@@ -27,26 +27,24 @@ use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
*
|
||||
|
||||
*/
|
||||
class MultiYearReportGenerator implements ReportGeneratorInterface
|
||||
{
|
||||
/** @var Collection The accounts involved. */
|
||||
private $accounts;
|
||||
|
||||
/** @var Carbon The end date. */
|
||||
private $end;
|
||||
|
||||
/** @var Carbon The start date. */
|
||||
private $start;
|
||||
|
||||
/**
|
||||
* Generates the report.
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function generate(): string
|
||||
@@ -60,20 +58,17 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
|
||||
'reports.default.multi-year',
|
||||
compact('accountIds', 'reportType')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
app('log')->error(sprintf('Cannot render reports.default.multi-year: %s', $e->getMessage()));
|
||||
app('log')->error($e->getTraceAsString());
|
||||
$result = sprintf('Could not render report view: %s', $e->getMessage());
|
||||
|
||||
throw new FireflyException($result, 0, $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the accounts used in the report.
|
||||
*
|
||||
* @param Collection $accounts
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setAccounts(Collection $accounts): ReportGeneratorInterface
|
||||
{
|
||||
@@ -84,10 +79,6 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Sets the budgets used in the report.
|
||||
*
|
||||
* @param Collection $budgets
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setBudgets(Collection $budgets): ReportGeneratorInterface
|
||||
{
|
||||
@@ -96,10 +87,6 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Sets the categories used in the report.
|
||||
*
|
||||
* @param Collection $categories
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setCategories(Collection $categories): ReportGeneratorInterface
|
||||
{
|
||||
@@ -108,10 +95,6 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Sets the end date used in the report.
|
||||
*
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setEndDate(Carbon $date): ReportGeneratorInterface
|
||||
{
|
||||
@@ -122,10 +105,6 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Unused setter for expenses.
|
||||
*
|
||||
* @param Collection $expense
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setExpense(Collection $expense): ReportGeneratorInterface
|
||||
{
|
||||
@@ -134,10 +113,6 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Set the start date of the report.
|
||||
*
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setStartDate(Carbon $date): ReportGeneratorInterface
|
||||
{
|
||||
@@ -148,10 +123,6 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Set the tags for the report.
|
||||
*
|
||||
* @param Collection $tags
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setTags(Collection $tags): ReportGeneratorInterface
|
||||
{
|
||||
|
@@ -27,26 +27,24 @@ use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
*
|
||||
|
||||
*/
|
||||
class YearReportGenerator implements ReportGeneratorInterface
|
||||
{
|
||||
/** @var Collection The accounts involved. */
|
||||
private $accounts;
|
||||
|
||||
/** @var Carbon The end date. */
|
||||
private $end;
|
||||
|
||||
/** @var Carbon The start date. */
|
||||
private $start;
|
||||
|
||||
/**
|
||||
* Generates the report.
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function generate(): string
|
||||
@@ -60,10 +58,11 @@ class YearReportGenerator implements ReportGeneratorInterface
|
||||
'reports.default.year',
|
||||
compact('accountIds', 'reportType')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
app('log')->error(sprintf('Cannot render reports.account.report: %s', $e->getMessage()));
|
||||
app('log')->error($e->getTraceAsString());
|
||||
$result = 'Could not render report view.';
|
||||
|
||||
throw new FireflyException($result, 0, $e);
|
||||
}
|
||||
|
||||
@@ -72,10 +71,6 @@ class YearReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Set the accounts.
|
||||
*
|
||||
* @param Collection $accounts
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setAccounts(Collection $accounts): ReportGeneratorInterface
|
||||
{
|
||||
@@ -86,10 +81,6 @@ class YearReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Unused budget setter.
|
||||
*
|
||||
* @param Collection $budgets
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setBudgets(Collection $budgets): ReportGeneratorInterface
|
||||
{
|
||||
@@ -98,10 +89,6 @@ class YearReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Unused categories setter.
|
||||
*
|
||||
* @param Collection $categories
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setCategories(Collection $categories): ReportGeneratorInterface
|
||||
{
|
||||
@@ -110,10 +97,6 @@ class YearReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Set the end date.
|
||||
*
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setEndDate(Carbon $date): ReportGeneratorInterface
|
||||
{
|
||||
@@ -124,10 +107,6 @@ class YearReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Set the expenses used.
|
||||
*
|
||||
* @param Collection $expense
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setExpense(Collection $expense): ReportGeneratorInterface
|
||||
{
|
||||
@@ -136,10 +115,6 @@ class YearReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Set the start date.
|
||||
*
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setStartDate(Carbon $date): ReportGeneratorInterface
|
||||
{
|
||||
@@ -150,10 +125,6 @@ class YearReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
/**
|
||||
* Unused tags setter.
|
||||
*
|
||||
* @param Collection $tags
|
||||
*
|
||||
* @return ReportGeneratorInterface
|
||||
*/
|
||||
public function setTags(Collection $tags): ReportGeneratorInterface
|
||||
{
|
||||
|
Reference in New Issue
Block a user