Reformat various code.

This commit is contained in:
James Cole
2022-03-29 14:58:06 +02:00
parent 1209c4e76a
commit 29bed2547c
140 changed files with 1004 additions and 1010 deletions

View File

@@ -98,10 +98,10 @@ class Authenticate
/** @noinspection PhpUndefinedMethodInspection */
/** @var User $user */
$user = $this->auth->authenticate();
if (1 === (int)$user->blocked) {
$message = (string)trans('firefly.block_account_logout');
if (1 === (int) $user->blocked) {
$message = (string) trans('firefly.block_account_logout');
if ('email_changed' === $user->blocked_code) {
$message = (string)trans('firefly.email_changed_logout');
$message = (string) trans('firefly.email_changed_logout');
}
app('session')->flash('logoutMessage', $message);
/** @noinspection PhpUndefinedMethodInspection */

View File

@@ -145,8 +145,8 @@ class Installer
private function oldDBVersion(): bool
{
// older version in config than database?
$configVersion = (int)config('firefly.db_version');
$dbVersion = (int)app('fireflyconfig')->getFresh('db_version', 1)->data;
$configVersion = (int) config('firefly.db_version');
$dbVersion = (int) app('fireflyconfig')->getFresh('db_version', 1)->data;
if ($configVersion > $dbVersion) {
Log::warning(
sprintf(
@@ -172,8 +172,8 @@ class Installer
private function oldVersion(): bool
{
// version compare thing.
$configVersion = (string)config('firefly.version');
$dbVersion = (string)app('fireflyconfig')->getFresh('ff3_version', '1.0')->data;
$configVersion = (string) config('firefly.version');
$dbVersion = (string) app('fireflyconfig')->getFresh('ff3_version', '1.0')->data;
if (1 === version_compare($configVersion, $dbVersion)) {
Log::warning(
sprintf(

View File

@@ -102,7 +102,7 @@ class InterestingMessage
// send message about newly created transaction group.
/** @var TransactionGroup $group */
$group = auth()->user()->transactionGroups()->with(['transactionJournals', 'transactionJournals.transactionType'])->find((int)$transactionGroupId);
$group = auth()->user()->transactionGroups()->with(['transactionJournals', 'transactionJournals.transactionType'])->find((int) $transactionGroupId);
if (null === $group) {
return;
@@ -118,17 +118,17 @@ class InterestingMessage
$title = $count > 1 ? $group->title : $journal->description;
if ('created' === $message) {
session()->flash('success_url', route('transactions.show', [$transactionGroupId]));
session()->flash('success', (string)trans('firefly.stored_journal', ['description' => $title]));
session()->flash('success', (string) trans('firefly.stored_journal', ['description' => $title]));
}
if ('updated' === $message) {
$type = strtolower($journal->transactionType->type);
session()->flash('success_url', route('transactions.show', [$transactionGroupId]));
session()->flash('success', (string)trans(sprintf('firefly.updated_%s', $type), ['description' => $title]));
session()->flash('success', (string) trans(sprintf('firefly.updated_%s', $type), ['description' => $title]));
}
if ('no_change' === $message) {
$type = strtolower($journal->transactionType->type);
session()->flash('warning_url', route('transactions.show', [$transactionGroupId]));
session()->flash('warning', (string)trans(sprintf('firefly.no_changes_%s', $type), ['description' => $title]));
session()->flash('warning', (string) trans(sprintf('firefly.no_changes_%s', $type), ['description' => $title]));
}
}
@@ -163,13 +163,13 @@ class InterestingMessage
return;
}
if ('deleted' === $message) {
session()->flash('success', (string)trans('firefly.account_deleted', ['name' => $account->name]));
session()->flash('success', (string) trans('firefly.account_deleted', ['name' => $account->name]));
}
if ('created' === $message) {
session()->flash('success', (string)trans('firefly.stored_new_account', ['name' => $account->name]));
session()->flash('success', (string) trans('firefly.stored_new_account', ['name' => $account->name]));
}
if ('updated' === $message) {
session()->flash('success', (string)trans('firefly.updated_account', ['name' => $account->name]));
session()->flash('success', (string) trans('firefly.updated_account', ['name' => $account->name]));
}
}
@@ -204,10 +204,10 @@ class InterestingMessage
return;
}
if ('deleted' === $message) {
session()->flash('success', (string)trans('firefly.deleted_bill', ['name' => $bill->name]));
session()->flash('success', (string) trans('firefly.deleted_bill', ['name' => $bill->name]));
}
if ('created' === $message) {
session()->flash('success', (string)trans('firefly.stored_new_bill', ['name' => $bill->name]));
session()->flash('success', (string) trans('firefly.stored_new_bill', ['name' => $bill->name]));
}
}
}

View File

@@ -53,7 +53,7 @@ class IsDemoUser
$repository = app(UserRepositoryInterface::class);
if ($repository->hasRole($user, 'demo')) {
Log::info('User is a demo user.');
$request->session()->flash('info', (string)trans('firefly.not_available_demo_user'));
$request->session()->flash('info', (string) trans('firefly.not_available_demo_user'));
$current = $request->url();
$previous = $request->session()->previousUrl();
if ($current !== $previous) {

View File

@@ -113,12 +113,12 @@ class Range
}
// save some formats:
$monthAndDayFormat = (string)trans('config.month_and_day_js', [], $locale);
$dateTimeFormat = (string)trans('config.date_time_js', [], $locale);
$monthAndDayFormat = (string) trans('config.month_and_day_js', [], $locale);
$dateTimeFormat = (string) trans('config.date_time_js', [], $locale);
$defaultCurrency = app('amount')->getDefaultCurrency();
// also format for moment JS:
$madMomentJS = (string)trans('config.month_and_day_moment_js', [], $locale);
$madMomentJS = (string) trans('config.month_and_day_moment_js', [], $locale);
app('view')->share('madMomentJS', $madMomentJS);
app('view')->share('monthAndDayFormat', $monthAndDayFormat);

View File

@@ -64,8 +64,8 @@ class SecureHeaders
$route = $request->route();
$customUrl = '';
$authGuard = (string)config('firefly.authentication_guard');
$logoutUrl = (string)config('firefly.custom_logout_url');
$authGuard = (string) config('firefly.authentication_guard');
$logoutUrl = (string) config('firefly.custom_logout_url');
if ('remote_user_guard' === $authGuard && '' !== $logoutUrl) {
$customUrl = $logoutUrl;
}
@@ -115,8 +115,8 @@ class SecureHeaders
*/
private function getTrackingScriptSource(): string
{
if ('' !== (string)config('firefly.tracker_site_id') && '' !== (string)config('firefly.tracker_url')) {
return (string)config('firefly.tracker_url');
if ('' !== (string) config('firefly.tracker_site_id') && '' !== (string) config('firefly.tracker_url')) {
return (string) config('firefly.tracker_url');
}
return '';

View File

@@ -25,7 +25,6 @@ namespace FireflyIII\Http\Middleware;
use Illuminate\Contracts\Session\Session;
use Illuminate\Http\Request;
use Illuminate\Session\Middleware\StartSession;
use Log;
/**
* Class StartFireflySession.

View File

@@ -45,6 +45,6 @@ class TrustProxies extends Middleware
*/
public function __construct()
{
$this->proxies = (string)config('firefly.trusted_proxies');
$this->proxies = (string) config('firefly.trusted_proxies');
}
}