mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Various PSR12 code cleanup
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* FrontpageChartGenerator.php
|
||||
* Copyright (c) 2020 james@firefly-iii.org
|
||||
@@ -23,6 +24,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Support\Chart\Budget;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
|
||||
@@ -64,9 +66,9 @@ class FrontpageChartGenerator
|
||||
{
|
||||
$budgets = $this->budgetRepository->getActiveBudgets();
|
||||
$data = [
|
||||
['label' => (string) trans('firefly.spent_in_budget'), 'entries' => [], 'type' => 'bar'],
|
||||
['label' => (string) trans('firefly.left_to_spend'), 'entries' => [], 'type' => 'bar'],
|
||||
['label' => (string) trans('firefly.overspent'), 'entries' => [], 'type' => 'bar'],
|
||||
['label' => (string)trans('firefly.spent_in_budget'), 'entries' => [], 'type' => 'bar'],
|
||||
['label' => (string)trans('firefly.left_to_spend'), 'entries' => [], 'type' => 'bar'],
|
||||
['label' => (string)trans('firefly.overspent'), 'entries' => [], 'type' => 'bar'],
|
||||
];
|
||||
|
||||
// loop al budgets:
|
||||
@@ -83,8 +85,8 @@ class FrontpageChartGenerator
|
||||
* When no limits are present, the time range is used to collect information on money spent.
|
||||
* If limits are present, each limit is processed individually.
|
||||
*
|
||||
* @param array $data
|
||||
* @param Budget $budget
|
||||
* @param array $data
|
||||
* @param Budget $budget
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -105,8 +107,8 @@ class FrontpageChartGenerator
|
||||
* When no limits are present, the expenses of the whole period are collected and grouped.
|
||||
* This is grouped per currency. Because there is no limit set, "left to spend" and "overspent" are empty.
|
||||
*
|
||||
* @param array $data
|
||||
* @param Budget $budget
|
||||
* @param array $data
|
||||
* @param Budget $budget
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -127,9 +129,9 @@ class FrontpageChartGenerator
|
||||
/**
|
||||
* If a budget has budget limit, each limit is processed individually.
|
||||
*
|
||||
* @param array $data
|
||||
* @param Budget $budget
|
||||
* @param Collection $limits
|
||||
* @param array $data
|
||||
* @param Budget $budget
|
||||
* @param Collection $limits
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -146,9 +148,9 @@ class FrontpageChartGenerator
|
||||
/**
|
||||
* For each limit, the expenses from the time range of the limit are collected. Each row from the result is processed individually.
|
||||
*
|
||||
* @param array $data
|
||||
* @param Budget $budget
|
||||
* @param BudgetLimit $limit
|
||||
* @param array $data
|
||||
* @param Budget $budget
|
||||
* @param BudgetLimit $limit
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -158,7 +160,7 @@ class FrontpageChartGenerator
|
||||
/** @var array $entry */
|
||||
foreach ($spent as $entry) {
|
||||
// only spent the entry where the entry's currency matches the budget limit's currency
|
||||
if ($entry['currency_id'] === (int) $limit->transaction_currency_id) {
|
||||
if ($entry['currency_id'] === (int)$limit->transaction_currency_id) {
|
||||
$data = $this->processRow($data, $budget, $limit, $entry);
|
||||
}
|
||||
}
|
||||
@@ -172,10 +174,10 @@ class FrontpageChartGenerator
|
||||
* Each one is added to the $data array. If the limit's date range is different from the global $start and $end dates,
|
||||
* for example when a limit only partially falls into this month, the title is expanded to clarify.
|
||||
*
|
||||
* @param array $data
|
||||
* @param Budget $budget
|
||||
* @param BudgetLimit $limit
|
||||
* @param array $entry
|
||||
* @param array $data
|
||||
* @param Budget $budget
|
||||
* @param BudgetLimit $limit
|
||||
* @param array $entry
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -201,7 +203,7 @@ class FrontpageChartGenerator
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Carbon $end
|
||||
* @param Carbon $end
|
||||
*/
|
||||
public function setEnd(Carbon $end): void
|
||||
{
|
||||
@@ -209,7 +211,7 @@ class FrontpageChartGenerator
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Carbon $start
|
||||
* @param Carbon $start
|
||||
*/
|
||||
public function setStart(Carbon $start): void
|
||||
{
|
||||
@@ -219,8 +221,8 @@ class FrontpageChartGenerator
|
||||
/**
|
||||
* A basic setter for the user. Also updates the repositories with the right user.
|
||||
*
|
||||
* @param User $user
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @param User $user
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function setUser(User $user): void
|
||||
{
|
||||
@@ -230,6 +232,6 @@ class FrontpageChartGenerator
|
||||
$this->opsRepository->setUser($user);
|
||||
|
||||
$locale = app('steam')->getLocale();
|
||||
$this->monthAndDayFormat = (string) trans('config.month_and_day_js', [], $locale);
|
||||
$this->monthAndDayFormat = (string)trans('config.month_and_day_js', [], $locale);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user