Code reordering and reformatting. I should really start employing style CI.

This commit is contained in:
James Cole
2021-09-18 10:26:12 +02:00
parent 9b9d52e99f
commit 4003cea759
344 changed files with 2776 additions and 2605 deletions

View File

@@ -37,6 +37,7 @@ use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use FireflyIII\Support\CacheProperties;
use Illuminate\Support\Collection;
use JsonException;
/**
* Trait AugumentData
@@ -190,7 +191,7 @@ trait AugumentData
* @param Carbon $end
*
* @return Collection
* @throws \JsonException
* @throws JsonException
*/
protected function getLimits(Budget $budget, Carbon $start, Carbon $end): Collection // get data + augment with info
{
@@ -207,7 +208,7 @@ trait AugumentData
$cache->addProperty('get-limits');
if ($cache->has()) {
return $cache->get();
return $cache->get();
}
$set = $blRepository->getBudgetLimits($budget, $start, $end);

View File

@@ -24,12 +24,14 @@ declare(strict_types=1);
namespace FireflyIII\Support\Http\Controllers;
use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\CacheProperties;
use Illuminate\Support\Collection;
use JsonException;
use Log;
/**
@@ -45,8 +47,8 @@ trait ChartGeneration
* @param Carbon $end
*
* @return array
* @throws \FireflyIII\Exceptions\FireflyException
* @throws \JsonException
* @throws FireflyException
* @throws JsonException
*/
protected function accountBalanceChart(Collection $accounts, Carbon $start, Carbon $end): array // chart helper method.
{
@@ -58,7 +60,7 @@ trait ChartGeneration
$cache->addProperty('chart.account.account-balance-chart');
$cache->addProperty($accounts);
if ($cache->has()) {
return $cache->get();
return $cache->get();
}
Log::debug('Regenerate chart.account.account-balance-chart from scratch.');
$locale = app('steam')->getLocale();
@@ -74,7 +76,7 @@ trait ChartGeneration
$chartData = [];
/** @var Account $account */
foreach ($accounts as $account) {
// See reference nr. 33
// See reference nr. 33
$currency = $repository->find((int)$accountRepos->getMetaValue($account, 'currency_id'));
if (null === $currency) {
$currency = $default;

View File

@@ -85,7 +85,7 @@ trait CreateStuff
$assetAccount = [
'name' => (string)trans('firefly.cash_wallet', [], $language),
'iban' => null,
'account_type_name' => 'asset',
'account_type_name' => 'asset',
'virtual_balance' => 0,
'account_type_id' => null,
'active' => true,
@@ -115,7 +115,7 @@ trait CreateStuff
}
// switch on class existence.
$keys= [];
$keys = [];
Log::info(sprintf('PHP version is %s', phpversion()));
if (class_exists(LegacyRSA::class)) {
// PHP 7
@@ -152,7 +152,7 @@ trait CreateStuff
$savingsAccount = [
'name' => (string)trans('firefly.new_savings_account', ['bank_name' => $request->get('bank_name')], $language),
'iban' => null,
'account_type_name' => 'asset',
'account_type_name' => 'asset',
'account_type_id' => null,
'virtual_balance' => 0,
'active' => true,

View File

@@ -88,17 +88,18 @@ trait DateCalculation
$step = '1D';
$months = $start->diffInMonths($end);
if ($months > 3) {
$step = '1W';
$step = '1W';
}
if ($months > 24) {
$step = '1M';
$step = '1M';
}
if ($months > 100) {
$step = '1Y';
$step = '1Y';
}
return $step;
}
/**
* Get a list of the periods that will occur after this date. For example,
* March 2018, April 2018, etc.

View File

@@ -22,7 +22,9 @@
declare(strict_types=1);
namespace FireflyIII\Support\Http\Controllers;
use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use Log;
/**
@@ -85,7 +87,7 @@ trait GetConfigurationData
* Get config for date range.
*
* @return array
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
protected function getDateRangeConfig(): array // get configuration + get preferences.
{

View File

@@ -115,7 +115,7 @@ trait ModelInformation
*/
protected function getTriggersForBill(Bill $bill): array // get info and augument
{
// See reference nr. 39
// See reference nr. 39
$operators = config('firefly.search.operators');
$triggers = [];
foreach ($operators as $key => $operator) {
@@ -167,7 +167,7 @@ trait ModelInformation
*/
private function getTriggersForJournal(TransactionJournal $journal): array
{
// See reference nr. 40
// See reference nr. 40
$operators = config('firefly.search.operators');
$triggers = [];
foreach ($operators as $key => $operator) {

View File

@@ -33,6 +33,7 @@ use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Support\CacheProperties;
use Illuminate\Support\Collection;
use JsonException;
use Log;
/**
@@ -78,7 +79,7 @@ trait PeriodOverview
*
* @return array
* @throws FireflyException
* @throws \JsonException
* @throws JsonException
*/
protected function getAccountPeriodOverview(Account $account, Carbon $start, Carbon $end): array
{
@@ -270,7 +271,7 @@ trait PeriodOverview
*
* @return array
* @throws FireflyException
* @throws \JsonException
* @throws JsonException
*/
protected function getCategoryPeriodOverview(Category $category, Carbon $start, Carbon $end): array
{
@@ -349,7 +350,7 @@ trait PeriodOverview
*
* @return array
* @throws FireflyException
* @throws \JsonException
* @throws JsonException
*/
protected function getNoBudgetPeriodOverview(Carbon $start, Carbon $end): array
{
@@ -403,7 +404,7 @@ trait PeriodOverview
*
* @return array
* @throws FireflyException
* @throws \JsonException
* @throws JsonException
*/
protected function getNoCategoryPeriodOverview(Carbon $theDate): array
{
@@ -484,7 +485,7 @@ trait PeriodOverview
*
* @return array
* @throws FireflyException
* @throws \JsonException
* @throws JsonException
*/
protected function getTagPeriodOverview(Tag $tag, Carbon $start, Carbon $end): array // period overview for tags.
{
@@ -559,7 +560,7 @@ trait PeriodOverview
*
* @return array
* @throws FireflyException
* @throws \JsonException
* @throws JsonException
*/
protected function getTransactionPeriodOverview(string $transactionType, Carbon $start, Carbon $end): array
{

View File

@@ -72,6 +72,7 @@ trait RenderPartialViews
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
}
return $view;
}
@@ -92,6 +93,7 @@ trait RenderPartialViews
Log::error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
$result = 'Could not render view.';
}
return $result;
}
@@ -122,6 +124,7 @@ trait RenderPartialViews
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
}
return $view;
}
@@ -169,6 +172,7 @@ trait RenderPartialViews
Log::error(sprintf('Cannot render reports.options.category: %s', $e->getMessage()));
$result = 'Could not render view.';
}
return $result;
}
@@ -209,6 +213,7 @@ trait RenderPartialViews
Log::error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
$result = 'Could not render view.';
}
return $result;
}
@@ -241,6 +246,7 @@ trait RenderPartialViews
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
}
return $view;
}
@@ -292,7 +298,7 @@ trait RenderPartialViews
*/
protected function getCurrentTriggers(Rule $rule): array // get info from object and present.
{
// See reference nr. 38
// See reference nr. 38
$operators = config('firefly.search.operators');
$triggers = [];
foreach ($operators as $key => $operator) {
@@ -362,6 +368,7 @@ trait RenderPartialViews
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
}
return $view;
}
@@ -379,6 +386,7 @@ trait RenderPartialViews
Log::error(sprintf('Cannot render reports.options.no-options: %s', $e->getMessage()));
$result = 'Could not render view.';
}
return $result;
}
@@ -400,6 +408,7 @@ trait RenderPartialViews
Log::error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
$result = 'Could not render view.';
}
return $result;
}
}

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Support\Http\Controllers;
use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Exceptions\ValidationException;
use FireflyIII\Helpers\Help\HelpInterface;
use FireflyIII\Http\Requests\TestRuleFormRequest;
@@ -113,25 +114,7 @@ trait RequestInformation
return $content;
}
return '<p>' . trans('firefly.route_has_no_help') . '</p>';
}
/**
* @return string
*/
final protected function getPageName(): string // get request info
{
return str_replace('.', '_', RouteFacade::currentRouteName());
}
/**
* Get the specific name of a page for intro.
*
* @return string
*/
final protected function getSpecificPageName(): string // get request info
{
return null === RouteFacade::current()->parameter('objectType') ? '' : '_' . RouteFacade::current()->parameter('objectType');
return '<p>' . trans('firefly.route_has_no_help') . '</p>';
}
/**
@@ -162,7 +145,7 @@ trait RequestInformation
* Returns if user has seen demo.
*
* @return bool
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
final protected function hasSeenDemo(): bool // get request info + get preference
{
@@ -181,12 +164,30 @@ trait RequestInformation
$shownDemo = app('preferences')->get($key, false)->data;
}
if (!is_bool($shownDemo)) {
$shownDemo = true;
$shownDemo = true;
}
return $shownDemo;
}
/**
* @return string
*/
final protected function getPageName(): string // get request info
{
return str_replace('.', '_', RouteFacade::currentRouteName());
}
/**
* Get the specific name of a page for intro.
*
* @return string
*/
final protected function getSpecificPageName(): string // get request info
{
return null === RouteFacade::current()->parameter('objectType') ? '' : '_' . RouteFacade::current()->parameter('objectType');
}
/**
* Check if date is outside session range.
*

View File

@@ -78,7 +78,7 @@ trait RuleManagement
*/
protected function getPreviousTriggers(Request $request): array
{
// See reference nr. 34
// See reference nr. 34
$operators = config('firefly.search.operators');
$triggers = [];
foreach ($operators as $key => $operator) {
@@ -123,7 +123,7 @@ trait RuleManagement
*/
protected function parseFromOperators(array $submittedOperators): array
{
// See reference nr. 35
// See reference nr. 35
$operators = config('firefly.search.operators');
$renderedEntries = [];
$triggers = [];

View File

@@ -60,7 +60,7 @@ trait UserNavigation
Log::debug(sprintf('The URI is %s', $uri));
if (str_contains($uri, 'jscript')) {
$uri = $this->redirectUri;
$uri = $this->redirectUri;
Log::debug(sprintf('URI is now %s (uri contains jscript)', $uri));
}