mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-03 11:08:28 +00:00
Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
@@ -118,7 +118,7 @@ class Navigation
|
||||
'year' => 'endOfYear',
|
||||
'yearly' => 'endOfYear',
|
||||
];
|
||||
$specials = ['mont', 'monthly'];
|
||||
$specials = ['mont', 'monthly'];
|
||||
|
||||
$currentEnd = clone $theCurrentEnd;
|
||||
|
||||
@@ -270,7 +270,7 @@ class Navigation
|
||||
'3M' => 'lastOfQuarter',
|
||||
'1Y' => 'endOfYear',
|
||||
];
|
||||
$end = clone $start;
|
||||
$end = clone $start;
|
||||
|
||||
if (isset($functionMap[$range])) {
|
||||
$function = $functionMap[$range];
|
||||
|
@@ -25,7 +25,7 @@ class Search implements SearchInterface
|
||||
public function searchAccounts(array $words)
|
||||
{
|
||||
return Auth::user()->accounts()->with('accounttype')->where(
|
||||
function (EloquentBuilder $q) use ($words) {
|
||||
function(EloquentBuilder $q) use ($words) {
|
||||
foreach ($words as $word) {
|
||||
$q->orWhere('name', 'LIKE', '%' . e($word) . '%');
|
||||
}
|
||||
@@ -43,7 +43,7 @@ class Search implements SearchInterface
|
||||
/** @var Collection $set */
|
||||
$set = Auth::user()->budgets()->get();
|
||||
$newSet = $set->filter(
|
||||
function (Budget $b) use ($words) {
|
||||
function(Budget $b) use ($words) {
|
||||
$found = 0;
|
||||
foreach ($words as $word) {
|
||||
if (!(strpos(strtolower($b->name), strtolower($word)) === false)) {
|
||||
@@ -68,7 +68,7 @@ class Search implements SearchInterface
|
||||
/** @var Collection $set */
|
||||
$set = Auth::user()->categories()->get();
|
||||
$newSet = $set->filter(
|
||||
function (Category $c) use ($words) {
|
||||
function(Category $c) use ($words) {
|
||||
$found = 0;
|
||||
foreach ($words as $word) {
|
||||
if (!(strpos(strtolower($c->name), strtolower($word)) === false)) {
|
||||
@@ -103,7 +103,7 @@ class Search implements SearchInterface
|
||||
{
|
||||
// decrypted transaction journals:
|
||||
$decrypted = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 0)->where(
|
||||
function (EloquentBuilder $q) use ($words) {
|
||||
function(EloquentBuilder $q) use ($words) {
|
||||
foreach ($words as $word) {
|
||||
$q->orWhere('description', 'LIKE', '%' . e($word) . '%');
|
||||
}
|
||||
@@ -113,7 +113,7 @@ class Search implements SearchInterface
|
||||
// encrypted
|
||||
$all = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 1)->get();
|
||||
$set = $all->filter(
|
||||
function (TransactionJournal $journal) use ($words) {
|
||||
function(TransactionJournal $journal) use ($words) {
|
||||
foreach ($words as $word) {
|
||||
$haystack = strtolower($journal->description);
|
||||
$word = strtolower($word);
|
||||
@@ -129,7 +129,7 @@ class Search implements SearchInterface
|
||||
$filtered = $set->merge($decrypted);
|
||||
|
||||
$filtered->sortBy(
|
||||
function (TransactionJournal $journal) {
|
||||
function(TransactionJournal $journal) {
|
||||
return intval($journal->date->format('U'));
|
||||
}
|
||||
);
|
||||
|
@@ -21,16 +21,16 @@ class Budget extends Twig_Extension
|
||||
{
|
||||
$functions = [];
|
||||
$functions[] = new Twig_SimpleFunction(
|
||||
'spentInRepetitionCorrected', function (LimitRepetition $repetition) {
|
||||
'spentInRepetitionCorrected', function(LimitRepetition $repetition) {
|
||||
$sum
|
||||
= Auth::user()->transactionjournals()
|
||||
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->leftJoin('budget_limits', 'budget_limits.budget_id', '=', 'budget_transaction_journal.budget_id')
|
||||
->leftJoin('limit_repetitions', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
|
||||
->before($repetition->enddate)
|
||||
->after($repetition->startdate)
|
||||
->where('limit_repetitions.id', '=', $repetition->id)
|
||||
->get(['transaction_journals.*'])->sum('amount');
|
||||
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->leftJoin('budget_limits', 'budget_limits.budget_id', '=', 'budget_transaction_journal.budget_id')
|
||||
->leftJoin('limit_repetitions', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
|
||||
->before($repetition->enddate)
|
||||
->after($repetition->startdate)
|
||||
->where('limit_repetitions.id', '=', $repetition->id)
|
||||
->get(['transaction_journals.*'])->sum('amount');
|
||||
|
||||
return floatval($sum);
|
||||
}
|
||||
|
@@ -31,31 +31,31 @@ class General extends Twig_Extension
|
||||
$filters = [];
|
||||
|
||||
$filters[] = new Twig_SimpleFilter(
|
||||
'formatAmount', function ($string) {
|
||||
'formatAmount', function($string) {
|
||||
return App::make('amount')->format($string);
|
||||
}, ['is_safe' => ['html']]
|
||||
);
|
||||
|
||||
$filters[] = new Twig_SimpleFilter(
|
||||
'formatTransaction', function (Transaction $transaction) {
|
||||
'formatTransaction', function(Transaction $transaction) {
|
||||
return App::make('amount')->formatTransaction($transaction);
|
||||
}, ['is_safe' => ['html']]
|
||||
);
|
||||
|
||||
$filters[] = new Twig_SimpleFilter(
|
||||
'formatAmountPlain', function ($string) {
|
||||
'formatAmountPlain', function($string) {
|
||||
return App::make('amount')->format($string, false);
|
||||
}, ['is_safe' => ['html']]
|
||||
);
|
||||
|
||||
$filters[] = new Twig_SimpleFilter(
|
||||
'formatJournal', function ($journal) {
|
||||
'formatJournal', function($journal) {
|
||||
return App::make('amount')->formatJournal($journal);
|
||||
}, ['is_safe' => ['html']]
|
||||
);
|
||||
|
||||
$filters[] = new Twig_SimpleFilter(
|
||||
'balance', function (Account $account = null) {
|
||||
'balance', function(Account $account = null) {
|
||||
if (is_null($account)) {
|
||||
return 'NULL';
|
||||
}
|
||||
@@ -67,7 +67,7 @@ class General extends Twig_Extension
|
||||
|
||||
// should be a function but OK
|
||||
$filters[] = new Twig_SimpleFilter(
|
||||
'getAccountRole', function ($name) {
|
||||
'getAccountRole', function($name) {
|
||||
return Config::get('firefly.accountRoles.' . $name);
|
||||
}
|
||||
);
|
||||
@@ -83,32 +83,32 @@ class General extends Twig_Extension
|
||||
$functions = [];
|
||||
|
||||
$functions[] = new Twig_SimpleFunction(
|
||||
'getCurrencyCode', function () {
|
||||
'getCurrencyCode', function() {
|
||||
return App::make('amount')->getCurrencyCode();
|
||||
}
|
||||
);
|
||||
|
||||
$functions[] = new Twig_SimpleFunction(
|
||||
'getCurrencySymbol', function () {
|
||||
'getCurrencySymbol', function() {
|
||||
return App::make('amount')->getCurrencySymbol();
|
||||
}
|
||||
);
|
||||
|
||||
$functions[] = new Twig_SimpleFunction(
|
||||
'phpdate', function ($str) {
|
||||
'phpdate', function($str) {
|
||||
return date($str);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
$functions[] = new Twig_SimpleFunction(
|
||||
'env', function ($name, $default) {
|
||||
'env', function($name, $default) {
|
||||
return env($name, $default);
|
||||
}
|
||||
);
|
||||
|
||||
$functions[] = new Twig_SimpleFunction(
|
||||
'activeRoute', function ($context) {
|
||||
'activeRoute', function($context) {
|
||||
$args = func_get_args();
|
||||
$route = $args[1];
|
||||
$what = isset($args[2]) ? $args[2] : false;
|
||||
|
@@ -26,7 +26,7 @@ class Journal extends Twig_Extension
|
||||
$filters = [];
|
||||
|
||||
$filters[] = new Twig_SimpleFilter(
|
||||
'typeIcon', function (TransactionJournal $journal) {
|
||||
'typeIcon', function(TransactionJournal $journal) {
|
||||
$type = $journal->transactionType->type;
|
||||
|
||||
switch ($type) {
|
||||
@@ -59,7 +59,7 @@ class Journal extends Twig_Extension
|
||||
$functions = [];
|
||||
|
||||
$functions[] = new Twig_SimpleFunction(
|
||||
'invalidJournal', function (TransactionJournal $journal) {
|
||||
'invalidJournal', function(TransactionJournal $journal) {
|
||||
if (!isset($journal->transactions[1]) || !isset($journal->transactions[0])) {
|
||||
return true;
|
||||
}
|
||||
@@ -69,7 +69,7 @@ class Journal extends Twig_Extension
|
||||
);
|
||||
|
||||
$functions[] = new Twig_SimpleFunction(
|
||||
'relevantTags', function (TransactionJournal $journal) {
|
||||
'relevantTags', function(TransactionJournal $journal) {
|
||||
if ($journal->tags->count() == 0) {
|
||||
return App::make('amount')->formatJournal($journal);
|
||||
}
|
||||
@@ -82,7 +82,7 @@ class Journal extends Twig_Extension
|
||||
$amount = App::make('amount')->format($journal->actual_amount, false);
|
||||
|
||||
return '<a href="' . route('tags.show', [$tag->id]) . '" class="label label-success" title="' . $amount
|
||||
. '"><i class="fa fa-fw fa-refresh"></i> ' . $tag->tag . '</a>';
|
||||
. '"><i class="fa fa-fw fa-refresh"></i> ' . $tag->tag . '</a>';
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -92,7 +92,7 @@ class Journal extends Twig_Extension
|
||||
$amount = App::make('amount')->formatJournal($journal, false);
|
||||
|
||||
return '<a href="' . route('tags.show', [$tag->id]) . '" class="label label-success" title="' . $amount
|
||||
. '"><i class="fa fa-fw fa-sort-numeric-desc"></i> ' . $tag->tag . '</a>';
|
||||
. '"><i class="fa fa-fw fa-sort-numeric-desc"></i> ' . $tag->tag . '</a>';
|
||||
}
|
||||
/*
|
||||
* AdvancePayment with a withdrawal will show the amount with a link to
|
||||
|
@@ -22,7 +22,7 @@ class PiggyBank extends Twig_Extension
|
||||
$functions = [];
|
||||
|
||||
$functions[] = new Twig_SimpleFunction(
|
||||
'currentRelevantRepAmount', function (PB $piggyBank) {
|
||||
'currentRelevantRepAmount', function(PB $piggyBank) {
|
||||
return $piggyBank->currentRelevantRep()->currentamount;
|
||||
}
|
||||
);
|
||||
|
@@ -21,7 +21,7 @@ class Translation extends Twig_Extension
|
||||
$filters = [];
|
||||
|
||||
$filters[] = new Twig_SimpleFilter(
|
||||
'_', function ($name) {
|
||||
'_', function($name) {
|
||||
|
||||
return trans('firefly.' . $name);
|
||||
|
||||
|
Reference in New Issue
Block a user