Various code cleanup.

This commit is contained in:
James Cole
2018-08-04 17:30:06 +02:00
parent 5af026674f
commit f0d3ca5d53
88 changed files with 552 additions and 311 deletions

View File

@@ -26,6 +26,8 @@ use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use FireflyIII\Helpers\Report\ReportHelperInterface;
use Illuminate\Support\Collection;
use Log;
use Throwable;
/**
* Class MonthReportGenerator.
@@ -43,7 +45,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
* Generates the report.
*
* @return string
* @throws \Throwable
*/
public function generate(): string
{
@@ -53,11 +54,17 @@ class MonthReportGenerator implements ReportGeneratorInterface
$accountIds = implode(',', $this->accounts->pluck('id')->toArray());
$reportType = 'default';
// continue!
return view(
'reports.default.month',
compact('bills', 'accountIds', 'reportType')
)->with('start', $this->start)->with('end', $this->end)->render();
try {
return view(
'reports.default.month',
compact('bills', 'accountIds', 'reportType')
)->with('start', $this->start)->with('end', $this->end)->render();
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.default.month: %s', $e->getMessage()));
$result = 'Could not render report view.';
}
return $result;
}
/**

View File

@@ -25,6 +25,8 @@ namespace FireflyIII\Generator\Report\Standard;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use Illuminate\Support\Collection;
use Log;
use Throwable;
/**
* Class MonthReportGenerator.
@@ -42,7 +44,6 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
* Generates the report.
*
* @return string
* @throws \Throwable
*/
public function generate(): string
{
@@ -50,11 +51,17 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
$accountIds = implode(',', $this->accounts->pluck('id')->toArray());
$reportType = 'default';
// continue!
return view(
'reports.default.multi-year',
compact('accountIds', 'reportType')
)->with('start', $this->start)->with('end', $this->end)->render();
try {
return view(
'reports.default.multi-year',
compact('accountIds', 'reportType')
)->with('start', $this->start)->with('end', $this->end)->render();
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.default.multi-year: %s', $e->getMessage()));
$result = 'Could not render report view.';
}
return $result;
}
/**

View File

@@ -25,6 +25,8 @@ namespace FireflyIII\Generator\Report\Standard;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use Illuminate\Support\Collection;
use Log;
use Throwable;
/**
* Class MonthReportGenerator.
@@ -42,7 +44,6 @@ class YearReportGenerator implements ReportGeneratorInterface
* Generates the report.
*
* @return string
* @throws \Throwable
*/
public function generate(): string
{
@@ -50,13 +51,20 @@ class YearReportGenerator implements ReportGeneratorInterface
$accountIds = implode(',', $this->accounts->pluck('id')->toArray());
$reportType = 'default';
// continue!
return view(
'reports.default.year',
compact('accountIds', 'reportType')
)->with('start', $this->start)->with('end', $this->end)->render();
try {
$result = view(
'reports.default.year',
compact('accountIds', 'reportType')
)->with('start', $this->start)->with('end', $this->end)->render();
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.account.report: %s', $e->getMessage()));
$result = 'Could not render report view.';
}
return $result;
}
/**
* Set the accounts.
*