diff --git a/.gitignore b/.gitignore index b1e27bfc74..d4cfc0d4fb 100755 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ Homestead.json Homestead.yaml .env public/google*.html +report.html diff --git a/app/Console/Commands/UpgradeFireflyInstructions.php b/app/Console/Commands/UpgradeFireflyInstructions.php index f98e84f86a..363e5089f7 100644 --- a/app/Console/Commands/UpgradeFireflyInstructions.php +++ b/app/Console/Commands/UpgradeFireflyInstructions.php @@ -50,10 +50,10 @@ class UpgradeFireflyInstructions extends Command public function handle() { - if ($this->argument('task') == 'update') { + if ($this->argument('task') === 'update') { $this->updateInstructions(); } - if ($this->argument('task') == 'install') { + if ($this->argument('task') === 'install') { $this->installInstructions(); } } diff --git a/app/Console/Commands/VerifyDatabase.php b/app/Console/Commands/VerifyDatabase.php index 52cf80c265..6e128e7f53 100644 --- a/app/Console/Commands/VerifyDatabase.php +++ b/app/Console/Commands/VerifyDatabase.php @@ -259,7 +259,7 @@ class VerifyDatabase extends Command { $plural = str_plural($name); $class = sprintf('FireflyIII\Models\%s', ucfirst($name)); - $field = $name == 'tag' ? 'tag' : 'name'; + $field = $name === 'tag' ? 'tag' : 'name'; $set = $class::leftJoin($name . '_transaction_journal', $plural . '.id', '=', $name . '_transaction_journal.' . $name . '_id') ->leftJoin('users', $plural . '.user_id', '=', 'users.id') ->distinct() diff --git a/app/Export/Entry/Entry.php b/app/Export/Entry/Entry.php index f4061f703b..13be79458e 100644 --- a/app/Export/Entry/Entry.php +++ b/app/Export/Entry/Entry.php @@ -88,7 +88,7 @@ final class Entry $entry->budget_name = $object->budget_name ?? ''; // update description when transaction description is different: - if (!is_null($object->description) && $object->description != $entry->description) { + if (!is_null($object->description) && $object->description !== $entry->description) { $entry->description = $entry->description . ' (' . $object->description . ')'; } diff --git a/app/Helpers/Collection/BalanceLine.php b/app/Helpers/Collection/BalanceLine.php index 73b1a0f486..c3d892b214 100644 --- a/app/Helpers/Collection/BalanceLine.php +++ b/app/Helpers/Collection/BalanceLine.php @@ -147,13 +147,13 @@ class BalanceLine if ($this->getBudget() instanceof BudgetModel && !is_null($this->getBudget()->id)) { return $this->getBudget()->name; } - if ($this->getRole() == self::ROLE_DEFAULTROLE) { + if ($this->getRole() === self::ROLE_DEFAULTROLE) { return strval(trans('firefly.no_budget')); } - if ($this->getRole() == self::ROLE_TAGROLE) { + if ($this->getRole() === self::ROLE_TAGROLE) { return strval(trans('firefly.coveredWithTags')); } - if ($this->getRole() == self::ROLE_DIFFROLE) { + if ($this->getRole() === self::ROLE_DIFFROLE) { return strval(trans('firefly.leftUnbalanced')); } diff --git a/app/Helpers/Collection/Bill.php b/app/Helpers/Collection/Bill.php index e78e31631b..0df4a5fd5b 100644 --- a/app/Helpers/Collection/Bill.php +++ b/app/Helpers/Collection/Bill.php @@ -96,7 +96,7 @@ class Bill { $set = $this->bills->sortBy( function (BillLine $bill) { - $active = intval($bill->getBill()->active) == 0 ? 1 : 0; + $active = intval($bill->getBill()->active) === 0 ? 1 : 0; $name = $bill->getBill()->name; return $active . $name; diff --git a/app/Helpers/Report/BalanceReportHelper.php b/app/Helpers/Report/BalanceReportHelper.php index 9c62ea1ebc..dadef8fe41 100644 --- a/app/Helpers/Report/BalanceReportHelper.php +++ b/app/Helpers/Report/BalanceReportHelper.php @@ -244,7 +244,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface foreach ($accounts as $account) { $leftEntry = $tagsLeft->filter( function (Tag $tag) use ($account) { - return $tag->account_id == $account->id; + return $tag->account_id === $account->id; } ); $left = '0'; diff --git a/app/Helpers/Report/BudgetReportHelper.php b/app/Helpers/Report/BudgetReportHelper.php index 55c6ea64a7..7fecb90c89 100644 --- a/app/Helpers/Report/BudgetReportHelper.php +++ b/app/Helpers/Report/BudgetReportHelper.php @@ -56,7 +56,7 @@ class BudgetReportHelper implements BudgetReportHelperInterface /** @var Budget $budget */ foreach ($set as $budget) { $budgetLimits = $this->repository->getBudgetLimits($budget, $start, $end); - if ($budgetLimits->count() == 0) { // no budget limit(s) for this budget + if ($budgetLimits->count() === 0) { // no budget limit(s) for this budget $spent = $this->repository->spentInPeriod(new Collection([$budget]), $accounts, $start, $end);// spent for budget in time range if (bccomp($spent, '0') === -1) { diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index a76de3ace7..24e04b7f7b 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -316,7 +316,7 @@ class AccountController extends Controller } } - if ($moment != 'all' && $loop > 1) { + if ($moment !== 'all' && $loop > 1) { $subTitle = trans( 'firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)] diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php index 3f06091f35..6827d58fe2 100644 --- a/app/Http/Controllers/AttachmentController.php +++ b/app/Http/Controllers/AttachmentController.php @@ -153,7 +153,7 @@ class AttachmentController extends Controller $image = 'images/page_green.png'; - if ($attachment->mime == 'application/pdf') { + if ($attachment->mime === 'application/pdf') { $image = 'images/page_white_acrobat.png'; } $file = public_path($image); diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php index 2418bde1b0..8a963cd57f 100644 --- a/app/Http/Controllers/BillController.php +++ b/app/Http/Controllers/BillController.php @@ -175,7 +175,7 @@ class BillController extends Controller */ public function rescan(Request $request, BillRepositoryInterface $repository, Bill $bill) { - if (intval($bill->active) == 0) { + if (intval($bill->active) === 0) { $request->session()->flash('warning', strval(trans('firefly.cannot_scan_inactive_bill'))); return redirect(URL::previous()); @@ -206,7 +206,7 @@ class BillController extends Controller /** @var Carbon $date */ $date = session('start'); $year = $date->year; - $page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page')); + $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page')); $pageSize = intval(Preferences::get('transactionPageSize', 50)->data); $yearAverage = $repository->getYearAverage($bill, $date); $overallAverage = $repository->getOverallAverage($bill); diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php index f9d6bd72a7..b223c477dc 100644 --- a/app/Http/Controllers/BudgetController.php +++ b/app/Http/Controllers/BudgetController.php @@ -81,7 +81,7 @@ class BudgetController extends Controller /** @var Carbon $end */ $end = session('end', Carbon::now()->endOfMonth()); $budgetLimit = $this->repository->updateLimitAmount($budget, $start, $end, $amount); - if ($amount == 0) { + if ($amount === 0) { $budgetLimit = null; } Preferences::mark(); @@ -293,7 +293,7 @@ class BudgetController extends Controller ); } - $page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page')); + $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page')); $pageSize = intval(Preferences::get('transactionPageSize', 50)->data); $count = 0; @@ -318,7 +318,7 @@ class BudgetController extends Controller } } - if ($moment != 'all' && $loop > 1) { + if ($moment !== 'all' && $loop > 1) { $subTitle = trans( 'firefly.without_budget_between', ['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)] @@ -357,7 +357,7 @@ class BudgetController extends Controller /** @var Carbon $start */ $start = session('first', Carbon::create()->startOfYear()); $end = new Carbon; - $page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page')); + $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page')); $pageSize = intval(Preferences::get('transactionPageSize', 50)->data); $limits = $this->getLimits($budget, $start, $end); $repetition = null; @@ -384,11 +384,11 @@ class BudgetController extends Controller */ public function showByBudgetLimit(Request $request, Budget $budget, BudgetLimit $budgetLimit) { - if ($budgetLimit->budget->id != $budget->id) { + if ($budgetLimit->budget->id !== $budget->id) { throw new FireflyException('This budget limit is not part of this budget.'); } - $page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page')); + $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page')); $pageSize = intval(Preferences::get('transactionPageSize', 50)->data); $subTitle = trans( 'firefly.budget_in_period', [ diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index c9aec777f4..4cf4389a2a 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -199,7 +199,7 @@ class CategoryController extends Controller ); } - $page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page')); + $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page')); $pageSize = intval(Preferences::get('transactionPageSize', 50)->data); $count = 0; @@ -224,7 +224,7 @@ class CategoryController extends Controller } } - if ($moment != 'all' && $loop > 1) { + if ($moment !== 'all' && $loop > 1) { $subTitle = trans( 'firefly.without_category_between', ['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)] @@ -247,7 +247,7 @@ class CategoryController extends Controller // default values: $subTitle = $category->name; $subTitleIcon = 'fa-bar-chart'; - $page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page')); + $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page')); $pageSize = intval(Preferences::get('transactionPageSize', 50)->data); $count = 0; $loop = 0; @@ -308,7 +308,7 @@ class CategoryController extends Controller } } - if ($moment != 'all' && $loop > 1) { + if ($moment !== 'all' && $loop > 1) { $subTitle = trans( 'firefly.journals_in_period_for_category', ['name' => $category->name, 'start' => $start->formatLocalized($this->monthAndDayFormat), @@ -463,7 +463,7 @@ class CategoryController extends Controller $accountRepository = app(AccountRepositoryInterface::class); $accounts = $accountRepository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]); $first = $repository->firstUseDate($category); - if ($first->year == 1900) { + if ($first->year === 1900) { $first = new Carbon; } $range = Preferences::get('viewRange', '1M')->data; diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php index 8a0d923231..4b74cfbf38 100644 --- a/app/Http/Controllers/Chart/BudgetController.php +++ b/app/Http/Controllers/Chart/BudgetController.php @@ -124,7 +124,7 @@ class BudgetController extends Controller */ public function budgetLimit(Budget $budget, BudgetLimit $budgetLimit) { - if ($budgetLimit->budget->id != $budget->id) { + if ($budgetLimit->budget->id !== $budget->id) { throw new FireflyException('This budget limit is not part of this budget.'); } diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php index e4301ee034..b6ac5e0973 100644 --- a/app/Http/Controllers/Chart/CategoryController.php +++ b/app/Http/Controllers/Chart/CategoryController.php @@ -67,7 +67,7 @@ class CategoryController extends Controller $start = $repository->firstUseDate($category); - if ($start->year == 1900) { + if ($start->year === 1900) { $start = new Carbon; } diff --git a/app/Http/Controllers/Chart/CategoryReportController.php b/app/Http/Controllers/Chart/CategoryReportController.php index 653996cf5d..a79073c863 100644 --- a/app/Http/Controllers/Chart/CategoryReportController.php +++ b/app/Http/Controllers/Chart/CategoryReportController.php @@ -247,7 +247,7 @@ class CategoryReportController extends Controller // remove all empty entries to prevent cluttering: $newSet = []; foreach ($chartData as $key => $entry) { - if (!array_sum($entry['entries']) == 0) { + if (!array_sum($entry['entries']) === 0) { $newSet[$key] = $chartData[$key]; } } diff --git a/app/Http/Controllers/Chart/TagReportController.php b/app/Http/Controllers/Chart/TagReportController.php index 5c3ee98ed1..d7e86825b6 100644 --- a/app/Http/Controllers/Chart/TagReportController.php +++ b/app/Http/Controllers/Chart/TagReportController.php @@ -231,7 +231,7 @@ class TagReportController extends Controller // remove all empty entries to prevent cluttering: $newSet = []; foreach ($chartData as $key => $entry) { - if (!array_sum($entry['entries']) == 0) { + if (!array_sum($entry['entries']) === 0) { $newSet[$key] = $chartData[$key]; } } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 7e4cca9547..d52e8e18f7 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -107,7 +107,7 @@ class HomeController extends Controller $types = config('firefly.accountTypesByIdentifier.asset'); $count = $repository->count($types); - if ($count == 0) { + if ($count === 0) { return redirect(route('new-user.index')); } diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.php index e86536bc7b..bac5c2492f 100644 --- a/app/Http/Controllers/JsonController.php +++ b/app/Http/Controllers/JsonController.php @@ -365,7 +365,7 @@ class JsonController extends Controller $keys = array_keys(config('firefly.rule-triggers')); $triggers = []; foreach ($keys as $key) { - if ($key != 'user_action') { + if ($key !== 'user_action') { $triggers[$key] = trans('firefly.rule_trigger_' . $key . '_choice'); } } diff --git a/app/Http/Controllers/NewUserController.php b/app/Http/Controllers/NewUserController.php index 478e5830d6..024076c1ef 100644 --- a/app/Http/Controllers/NewUserController.php +++ b/app/Http/Controllers/NewUserController.php @@ -93,7 +93,7 @@ class NewUserController extends Controller $count++; } $message = strval(trans('firefly.stored_new_accounts_new_user')); - if ($count == 1) { + if ($count === 1) { $message = strval(trans('firefly.stored_new_account_new_user')); } diff --git a/app/Http/Controllers/RuleController.php b/app/Http/Controllers/RuleController.php index ba4dc6d208..5ab2f5e4ae 100644 --- a/app/Http/Controllers/RuleController.php +++ b/app/Http/Controllers/RuleController.php @@ -282,7 +282,7 @@ class RuleController extends Controller // build trigger array from response $triggers = $this->getValidTriggerList($request); - if (count($triggers) == 0) { + if (count($triggers) === 0) { return Response::json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]); } @@ -298,10 +298,10 @@ class RuleController extends Controller // Warn the user if only a subset of transactions is returned $warning = ''; - if (count($matchingTransactions) == $limit) { + if (count($matchingTransactions) === $limit) { $warning = trans('firefly.warning_transaction_subset', ['max_num_transactions' => $limit]); } - if (count($matchingTransactions) == 0) { + if (count($matchingTransactions) === 0) { $warning = trans('firefly.warning_no_matching_transactions', ['num_transactions' => $range]); } @@ -440,7 +440,7 @@ class RuleController extends Controller /** @var RuleTrigger $entry */ foreach ($rule->ruleTriggers as $entry) { - if ($entry->trigger_type != 'user_action') { + if ($entry->trigger_type !== 'user_action') { $count = ($index + 1); $triggers[] = view( 'rules.partials.trigger', diff --git a/app/Http/Controllers/RuleGroupController.php b/app/Http/Controllers/RuleGroupController.php index 12f9a0bb58..d0f60c08d3 100644 --- a/app/Http/Controllers/RuleGroupController.php +++ b/app/Http/Controllers/RuleGroupController.php @@ -253,7 +253,7 @@ class RuleGroupController extends Controller $data = [ 'title' => $request->input('title'), 'description' => $request->input('description'), - 'active' => intval($request->input('active')) == 1, + 'active' => intval($request->input('active')) === 1, ]; $repository->update($ruleGroup, $data); diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index f014f8325a..44f880045a 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -51,6 +51,10 @@ class SearchController extends Controller */ public function index(Request $request, SearchInterface $searcher) { + $query = $request->get('q'); + + return view('search.index',compact('query')); + // yes, hard coded values: $minSearchLen = 1; $limit = 20; diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index ce6f2db7d6..f373fa7dff 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -236,7 +236,7 @@ class TagController extends Controller // default values: $subTitle = $tag->tag; $subTitleIcon = 'fa-tag'; - $page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page')); + $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page')); $pageSize = intval(Preferences::get('transactionPageSize', 50)->data); $count = 0; $loop = 0; @@ -301,7 +301,7 @@ class TagController extends Controller } } - if ($moment != 'all' && $loop > 1) { + if ($moment !== 'all' && $loop > 1) { $subTitle = trans( 'firefly.journals_in_period_for_tag', ['tag' => $tag->tag, 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)] diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php index 8b3abddfce..fe5c99c4b3 100644 --- a/app/Http/Controllers/Transaction/MassController.php +++ b/app/Http/Controllers/Transaction/MassController.php @@ -86,7 +86,7 @@ class MassController extends Controller foreach ($ids as $journalId) { /** @var TransactionJournal $journal */ $journal = $repository->find(intval($journalId)); - if (!is_null($journal->id) && $journalId == $journal->id) { + if (!is_null($journal->id) && $journalId === $journal->id) { $set->push($journal); } } diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php index ee51362b27..e506a6fa57 100644 --- a/app/Http/Controllers/TransactionController.php +++ b/app/Http/Controllers/TransactionController.php @@ -70,7 +70,7 @@ class TransactionController extends Controller // default values: $subTitleIcon = config('firefly.transactionIconsByWhat.' . $what); $types = config('firefly.transactionTypesByWhat.' . $what); - $page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page')); + $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page')); $pageSize = intval(Preferences::get('transactionPageSize', 50)->data); $count = 0; $loop = 0; @@ -131,7 +131,7 @@ class TransactionController extends Controller } } - if ($moment != 'all' && $loop > 1) { + if ($moment !== 'all' && $loop > 1) { $subTitle = trans( 'firefly.title_' . $what . '_between', ['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)] diff --git a/app/Http/Requests/TagFormRequest.php b/app/Http/Requests/TagFormRequest.php index d61e5cb8d9..1348a0d767 100644 --- a/app/Http/Requests/TagFormRequest.php +++ b/app/Http/Requests/TagFormRequest.php @@ -37,7 +37,7 @@ class TagFormRequest extends Request */ public function collectTagData(): array { - if ($this->get('setTag') == 'true') { + if ($this->get('setTag') === 'true') { $latitude = $this->string('latitude'); $longitude = $this->string('longitude'); $zoomLevel = $this->integer('zoomLevel'); diff --git a/app/Import/Converter/Amount.php b/app/Import/Converter/Amount.php index 4cd861e25d..75f90a534d 100644 --- a/app/Import/Converter/Amount.php +++ b/app/Import/Converter/Amount.php @@ -36,10 +36,10 @@ class Amount implements ConverterInterface $decimalPosition = $len - 3; $decimal = null; - if (($len > 2 && $value{$decimalPosition} == '.') || ($len > 2 && strpos($value, '.') > $decimalPosition)) { + if (($len > 2 && $value{$decimalPosition} === '.') || ($len > 2 && strpos($value, '.') > $decimalPosition)) { $decimal = '.'; } - if ($len > 2 && $value{$decimalPosition} == ',') { + if ($len > 2 && $value{$decimalPosition} === ',') { $decimal = ','; } diff --git a/app/Import/Mapper/AssetAccountIbans.php b/app/Import/Mapper/AssetAccountIbans.php index 9f6d58ac5b..9d53bf6d8c 100644 --- a/app/Import/Mapper/AssetAccountIbans.php +++ b/app/Import/Mapper/AssetAccountIbans.php @@ -42,7 +42,7 @@ class AssetAccountIbans implements MapperInterface if (strlen($iban) > 0) { $topList[$account->id] = $account->iban . ' (' . $account->name . ')'; } - if (strlen($iban) == 0) { + if (strlen($iban) === 0) { $list[$account->id] = $account->name; } } diff --git a/app/Import/Mapper/OpposingAccountIbans.php b/app/Import/Mapper/OpposingAccountIbans.php index 3a4299c26a..121395cac4 100644 --- a/app/Import/Mapper/OpposingAccountIbans.php +++ b/app/Import/Mapper/OpposingAccountIbans.php @@ -48,7 +48,7 @@ class OpposingAccountIbans implements MapperInterface if (strlen($iban) > 0) { $topList[$account->id] = $account->iban . ' (' . $account->name . ')'; } - if (strlen($iban) == 0) { + if (strlen($iban) === 0) { $list[$account->id] = $account->name; } } diff --git a/app/Import/Routine/ImportRoutine.php b/app/Import/Routine/ImportRoutine.php index adaeab72a2..b032bc06d8 100644 --- a/app/Import/Routine/ImportRoutine.php +++ b/app/Import/Routine/ImportRoutine.php @@ -152,11 +152,9 @@ class ImportRoutine Log::debug(sprintf('Linking journal #%d to tag #%d...', $journalId, $tagId)); DB::table('tag_transaction_journal')->insert(['transaction_journal_id' => $journalId, 'tag_id' => $tagId]); } - Log::debug('Done!'); Log::info(sprintf('Linked %d journals to tag #%d ("%s")', $this->journals->count(), $tag->id, $tag->tag)); return $tag; - } /** diff --git a/app/Import/Specifics/AbnAmroDescription.php b/app/Import/Specifics/AbnAmroDescription.php index b0eebd0904..6ae80774b5 100644 --- a/app/Import/Specifics/AbnAmroDescription.php +++ b/app/Import/Specifics/AbnAmroDescription.php @@ -103,7 +103,7 @@ class AbnAmroDescription implements SpecificInterface $this->row[8] = $matches[4]; // 'opposing-account-name' $this->row[7] = $matches[4]; // 'description' - if ($matches[1] == 'GEA') { + if ($matches[1] === 'GEA') { $this->row[7] = 'GEA ' . $matches[4]; // 'description' } diff --git a/app/Jobs/MailError.php b/app/Jobs/MailError.php index 05de2aca0a..fd4a0164ff 100644 --- a/app/Jobs/MailError.php +++ b/app/Jobs/MailError.php @@ -80,7 +80,7 @@ class MailError extends Job implements ShouldQueue Mail::send( ['emails.error-html', 'emails.error-text'], $args, function (Message $message) use ($email) { - if ($email != 'mail@example.com') { + if ($email !== 'mail@example.com') { $message->to($email, $email)->subject('Caught an error in Firely III'); } } diff --git a/app/Models/Account.php b/app/Models/Account.php index cfef7e34af..f6b4481c1d 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -95,7 +95,7 @@ class Account extends Model /** @var Account $account */ foreach ($set as $account) { - if ($account->name == $fields['name']) { + if ($account->name === $fields['name']) { return $account; } } @@ -116,7 +116,7 @@ class Account extends Model { if (auth()->check()) { - if ($value->user_id == auth()->user()->id) { + if ($value->user_id === auth()->user()->id) { return $value; } } @@ -187,7 +187,7 @@ class Account extends Model public function getMeta(string $fieldName): string { foreach ($this->accountMeta as $meta) { - if ($meta->name == $fieldName) { + if ($meta->name === $fieldName) { return strval($meta->data); } } diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php index ddca8ad0d1..ce8eeec9fc 100644 --- a/app/Models/Attachment.php +++ b/app/Models/Attachment.php @@ -55,7 +55,7 @@ class Attachment extends Model { if (auth()->check()) { - if ($value->user_id == auth()->user()->id) { + if ($value->user_id === auth()->user()->id) { return $value; } } diff --git a/app/Models/Bill.php b/app/Models/Bill.php index 4a858720e5..d879cbd8d3 100644 --- a/app/Models/Bill.php +++ b/app/Models/Bill.php @@ -62,7 +62,7 @@ class Bill extends Model public static function routeBinder(Bill $value) { if (auth()->check()) { - if ($value->user_id == auth()->user()->id) { + if ($value->user_id === auth()->user()->id) { return $value; } } @@ -77,7 +77,7 @@ class Bill extends Model public function getMatchAttribute($value) { - if (intval($this->match_encrypted) == 1) { + if (intval($this->match_encrypted) === 1) { return Crypt::decrypt($value); } @@ -92,7 +92,7 @@ class Bill extends Model public function getNameAttribute($value) { - if (intval($this->name_encrypted) == 1) { + if (intval($this->name_encrypted) === 1) { return Crypt::decrypt($value); } diff --git a/app/Models/Budget.php b/app/Models/Budget.php index d5f71f21ee..cbbaafab24 100644 --- a/app/Models/Budget.php +++ b/app/Models/Budget.php @@ -66,7 +66,7 @@ class Budget extends Model $set = $query->get(['budgets.*']); /** @var Budget $budget */ foreach ($set as $budget) { - if ($budget->name == $fields['name']) { + if ($budget->name === $fields['name']) { return $budget; } } @@ -85,7 +85,7 @@ class Budget extends Model public static function routeBinder(Budget $value) { if (auth()->check()) { - if ($value->user_id == auth()->user()->id) { + if ($value->user_id === auth()->user()->id) { return $value; } } diff --git a/app/Models/Category.php b/app/Models/Category.php index fd7241702f..e10e384d35 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -67,7 +67,7 @@ class Category extends Model $set = $query->get(['categories.*']); /** @var Category $category */ foreach ($set as $category) { - if ($category->name == $fields['name']) { + if ($category->name === $fields['name']) { return $category; } } @@ -86,7 +86,7 @@ class Category extends Model public static function routeBinder(Category $value) { if (auth()->check()) { - if ($value->user_id == auth()->user()->id) { + if ($value->user_id === auth()->user()->id) { return $value; } } diff --git a/app/Models/ImportJob.php b/app/Models/ImportJob.php index 4f23de2c83..dea6e581c9 100644 --- a/app/Models/ImportJob.php +++ b/app/Models/ImportJob.php @@ -124,7 +124,7 @@ class ImportJob extends Model if (is_null($value)) { return []; } - if (strlen($value) == 0) { + if (strlen($value) === 0) { return []; } @@ -138,7 +138,7 @@ class ImportJob extends Model */ public function getExtendedStatusAttribute($value) { - if (strlen($value) == 0) { + if (strlen($value) === 0) { return []; } diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php index e648623ba4..e7659a80e8 100644 --- a/app/Models/PiggyBank.php +++ b/app/Models/PiggyBank.php @@ -58,7 +58,7 @@ class PiggyBank extends Model public static function routeBinder(PiggyBank $value) { if (auth()->check()) { - if ($value->account->user_id == auth()->user()->id) { + if ($value->account->user_id === auth()->user()->id) { return $value; } } diff --git a/app/Models/Rule.php b/app/Models/Rule.php index 28637d2893..59d572c424 100644 --- a/app/Models/Rule.php +++ b/app/Models/Rule.php @@ -51,7 +51,7 @@ class Rule extends Model public static function routeBinder(Rule $value) { if (auth()->check()) { - if ($value->user_id == auth()->user()->id) { + if ($value->user_id === auth()->user()->id) { return $value; } } diff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.php index 8ab7f6a117..1b62d9a1fe 100644 --- a/app/Models/RuleGroup.php +++ b/app/Models/RuleGroup.php @@ -52,7 +52,7 @@ class RuleGroup extends Model public static function routeBinder(RuleGroup $value) { if (auth()->check()) { - if ($value->user_id == auth()->user()->id) { + if ($value->user_id === auth()->user()->id) { return $value; } } diff --git a/app/Models/Tag.php b/app/Models/Tag.php index 21430124c2..4ac3c24356 100644 --- a/app/Models/Tag.php +++ b/app/Models/Tag.php @@ -66,7 +66,7 @@ class Tag extends Model $set = $query->get(['tags.*']); /** @var Tag $tag */ foreach ($set as $tag) { - if ($tag->tag == $fields['tag']) { + if ($tag->tag === $fields['tag']) { return $tag; } } @@ -87,7 +87,7 @@ class Tag extends Model public static function routeBinder(Tag $value) { if (auth()->check()) { - if ($value->user_id == auth()->user()->id) { + if ($value->user_id === auth()->user()->id) { return $value; } } diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php index bfb4de8bdc..977ef1ea90 100644 --- a/app/Models/TransactionJournal.php +++ b/app/Models/TransactionJournal.php @@ -207,7 +207,7 @@ class TransactionJournal extends Model public function isDeposit(): bool { if (!is_null($this->transaction_type_type)) { - return $this->transaction_type_type == TransactionType::DEPOSIT; + return $this->transaction_type_type === TransactionType::DEPOSIT; } return $this->transactionType->isDeposit(); @@ -220,7 +220,7 @@ class TransactionJournal extends Model public function isOpeningBalance(): bool { if (!is_null($this->transaction_type_type)) { - return $this->transaction_type_type == TransactionType::OPENING_BALANCE; + return $this->transaction_type_type === TransactionType::OPENING_BALANCE; } return $this->transactionType->isOpeningBalance(); @@ -233,7 +233,7 @@ class TransactionJournal extends Model public function isTransfer(): bool { if (!is_null($this->transaction_type_type)) { - return $this->transaction_type_type == TransactionType::TRANSFER; + return $this->transaction_type_type === TransactionType::TRANSFER; } return $this->transactionType->isTransfer(); @@ -246,7 +246,7 @@ class TransactionJournal extends Model public function isWithdrawal(): bool { if (!is_null($this->transaction_type_type)) { - return $this->transaction_type_type == TransactionType::WITHDRAWAL; + return $this->transaction_type_type === TransactionType::WITHDRAWAL; } return $this->transactionType->isWithdrawal(); diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index 037b73094e..ba8c207939 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -179,7 +179,7 @@ class AccountRepository implements AccountRepositoryInterface { // update the account: $account->name = $data['name']; - $account->active = $data['active'] == '1' ? true : false; + $account->active = $data['active'] === '1' ? true : false; $account->virtual_balance = $data['virtualBalance']; $account->iban = $data['iban']; $account->save(); @@ -460,12 +460,12 @@ class AccountRepository implements AccountRepositoryInterface // update transactions: /** @var Transaction $transaction */ foreach ($journal->transactions()->get() as $transaction) { - if ($account->id == $transaction->account_id) { + if ($account->id === $transaction->account_id) { $transaction->amount = $amount; $transaction->transaction_currency_id = $currencyId; $transaction->save(); } - if ($account->id != $transaction->account_id) { + if ($account->id !== $transaction->account_id) { $transaction->amount = bcmul($amount, '-1'); $transaction->transaction_currency_id = $currencyId; $transaction->save(); diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index 00ce78394f..e6957abe4b 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -116,7 +116,7 @@ class BillRepository implements BillRepositoryInterface $set = $set->sortBy( function (Bill $bill) { - $int = $bill->active == 1 ? 0 : 1; + $int = $bill->active === 1 ? 0 : 1; return $int . strtolower($bill->name); } @@ -168,7 +168,7 @@ class BillRepository implements BillRepositoryInterface $set = $set->sortBy( function (Bill $bill) { - $int = $bill->active == 1 ? 0 : 1; + $int = $bill->active === 1 ? 0 : 1; return $int . strtolower($bill->name); } @@ -500,7 +500,7 @@ class BillRepository implements BillRepositoryInterface return true; } - if ($bill->id == $journal->bill_id) { + if ($bill->id === $journal->bill_id) { // if no match, but bill used to match, remove it: $journal->bill_id = null; $journal->save(); diff --git a/app/Repositories/Journal/UpdateJournalsTrait.php b/app/Repositories/Journal/UpdateJournalsTrait.php index 9bf2cae058..d4264818a6 100644 --- a/app/Repositories/Journal/UpdateJournalsTrait.php +++ b/app/Repositories/Journal/UpdateJournalsTrait.php @@ -73,7 +73,7 @@ trait UpdateJournalsTrait protected function updateDestinationTransaction(TransactionJournal $journal, Account $account, array $data) { $set = $journal->transactions()->where('amount', '>', 0)->get(); - if ($set->count() != 1) { + if ($set->count() !== 1) { throw new FireflyException(sprintf('Journal #%d has %d transactions with an amount more than zero.', $journal->id, $set->count())); } /** @var Transaction $transaction */ @@ -98,7 +98,7 @@ trait UpdateJournalsTrait { // should be one: $set = $journal->transactions()->where('amount', '<', 0)->get(); - if ($set->count() != 1) { + if ($set->count() !== 1) { throw new FireflyException(sprintf('Journal #%d has %d transactions with an amount more than zero.', $journal->id, $set->count())); } /** @var Transaction $transaction */ @@ -140,7 +140,7 @@ trait UpdateJournalsTrait DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal->id)->whereNotIn('tag_id', $ids)->delete(); } // if count is zero, delete them all: - if (count($ids) == 0) { + if (count($ids) === 0) { DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal->id)->delete(); } diff --git a/app/Repositories/Rule/RuleRepository.php b/app/Repositories/Rule/RuleRepository.php index 47a848427c..5d3a1f2d47 100644 --- a/app/Repositories/Rule/RuleRepository.php +++ b/app/Repositories/Rule/RuleRepository.php @@ -236,7 +236,7 @@ class RuleRepository implements RuleRepositoryInterface $rule->rule_group_id = $data['rule_group_id']; $rule->order = ($order + 1); $rule->active = 1; - $rule->stop_processing = intval($data['stop_processing']) == 1; + $rule->stop_processing = intval($data['stop_processing']) === 1; $rule->title = $data['title']; $rule->description = strlen($data['description']) > 0 ? $data['description'] : null; diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php index ab1ab14317..581fb72ebf 100644 --- a/app/Repositories/Tag/TagRepository.php +++ b/app/Repositories/Tag/TagRepository.php @@ -282,7 +282,7 @@ class TagRepository implements TagRepositoryInterface * changed to an advancePayment. */ - if ($tag->tagMode == 'balancingAct' || $tag->tagMode == 'nothing') { + if ($tag->tagMode === 'balancingAct' || $tag->tagMode === 'nothing') { foreach ($tag->transactionjournals as $journal) { if ($journal->isTransfer()) { return false; @@ -394,7 +394,7 @@ class TagRepository implements TagRepositoryInterface } // if already has transaction journals, must match ALL asset account id's: - if ($deposits > 0 || $withdrawals == 1) { + if ($deposits > 0 || $withdrawals === 1) { Log::debug('Need to match all asset accounts.'); return $this->matchAll($journal, $tag); diff --git a/app/Rules/Actions/RemoveTag.php b/app/Rules/Actions/RemoveTag.php index ca9912f5f0..525579f0ed 100644 --- a/app/Rules/Actions/RemoveTag.php +++ b/app/Rules/Actions/RemoveTag.php @@ -52,7 +52,7 @@ class RemoveTag implements ActionInterface /** @var Tag $tag */ $tag = $journal->user->tags()->get()->filter( function (Tag $tag) use ($name) { - return $tag->tag == $name; + return $tag->tag === $name; } )->first(); diff --git a/app/Rules/Actions/SetBudget.php b/app/Rules/Actions/SetBudget.php index 62b530b8c8..599f0214da 100644 --- a/app/Rules/Actions/SetBudget.php +++ b/app/Rules/Actions/SetBudget.php @@ -56,7 +56,7 @@ class SetBudget implements ActionInterface $budgets = $repository->getActiveBudgets(); $budget = $budgets->filter( function (Budget $current) use ($search) { - return $current->name == $search; + return $current->name === $search; } )->first(); if (is_null($budget)) { @@ -65,7 +65,7 @@ class SetBudget implements ActionInterface return true; } - if ($journal->transactionType->type == TransactionType::TRANSFER) { + if ($journal->transactionType->type === TransactionType::TRANSFER) { Log::debug(sprintf('RuleAction SetBudget could not set budget of journal #%d to "%s" because journal is a transfer.', $journal->id, $search)); return true; diff --git a/app/Rules/Processor.php b/app/Rules/Processor.php index 579521af61..ae0ecb1fd8 100644 --- a/app/Rules/Processor.php +++ b/app/Rules/Processor.php @@ -254,7 +254,7 @@ final class Processor } } - $result = ($hitTriggers == $foundTriggers && $foundTriggers > 0); + $result = ($hitTriggers === $foundTriggers && $foundTriggers > 0); Log::debug('Result of triggered()', ['hitTriggers' => $hitTriggers, 'foundTriggers' => $foundTriggers, 'result' => $result]); return $result; diff --git a/app/Support/CacheProperties.php b/app/Support/CacheProperties.php index f4cf7c0984..d83e8e73a6 100644 --- a/app/Support/CacheProperties.php +++ b/app/Support/CacheProperties.php @@ -75,7 +75,7 @@ class CacheProperties */ public function has(): bool { - if (getenv('APP_ENV') == 'testing') { + if (getenv('APP_ENV') === 'testing') { return false; } $this->md5(); diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php index dc28a613db..464fbed037 100644 --- a/app/Support/Navigation.php +++ b/app/Support/Navigation.php @@ -96,7 +96,7 @@ class Navigation // if the range is custom, the end of the period // is another X days (x is the difference between start) // and end added to $theCurrentEnd - if ($repeatFreq == 'custom') { + if ($repeatFreq === 'custom') { /** @var Carbon $tStart */ $tStart = session('start', Carbon::now()->startOfMonth()); /** @var Carbon $tEnd */ @@ -393,7 +393,7 @@ class Navigation return $date; } - if ($repeatFreq == 'half-year' || $repeatFreq == '6M') { + if ($repeatFreq === 'half-year' || $repeatFreq === '6M') { $month = $date->month; $date->startOfYear(); if ($month >= 7) { @@ -496,7 +496,7 @@ class Navigation return $end; } - if ($range == '6M') { + if ($range === '6M') { if ($start->month >= 7) { $end->endOfYear(); @@ -532,7 +532,7 @@ class Navigation return $start; } - if ($range == '6M') { + if ($range === '6M') { if ($start->month >= 7) { $start->startOfYear()->addMonths(6); diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php index 9603e54e44..09183c84e5 100644 --- a/app/Support/Twig/General.php +++ b/app/Support/Twig/General.php @@ -110,7 +110,7 @@ class General extends Twig_Extension $what = $args[2]; // name of the route. $activeWhat = $context['what'] ?? false; - if ($what == $activeWhat && !(strpos(Route::getCurrentRoute()->getName(), $route) === false)) { + if ($what === $activeWhat && !(strpos(Route::getCurrentRoute()->getName(), $route) === false)) { return 'active'; } @@ -132,7 +132,7 @@ class General extends Twig_Extension $args = func_get_args(); $route = $args[0]; // name of the route. - if (Route::getCurrentRoute()->getName() == $route) { + if (Route::getCurrentRoute()->getName() === $route) { return 'active'; } diff --git a/app/Support/Twig/Journal.php b/app/Support/Twig/Journal.php index d3c0f314e5..82a5553c4d 100644 --- a/app/Support/Twig/Journal.php +++ b/app/Support/Twig/Journal.php @@ -51,7 +51,7 @@ class Journal extends Twig_Extension $array = []; /** @var Account $entry */ foreach ($list as $entry) { - if ($entry->accountType->type == AccountType::CASH) { + if ($entry->accountType->type === AccountType::CASH) { $array[] = '(cash)'; continue; } @@ -123,7 +123,7 @@ class Journal extends Twig_Extension $array = []; /** @var Account $entry */ foreach ($list as $entry) { - if ($entry->accountType->type == 'Cash account') { + if ($entry->accountType->type === AccountType::CASH) { $array[] = '(cash)'; continue; } diff --git a/app/Support/Twig/Rule.php b/app/Support/Twig/Rule.php index 2503cec452..9924e6f7a0 100644 --- a/app/Support/Twig/Rule.php +++ b/app/Support/Twig/Rule.php @@ -70,7 +70,7 @@ class Rule extends Twig_Extension $ruleTriggers = array_keys(Config::get('firefly.rule-triggers')); $possibleTriggers = []; foreach ($ruleTriggers as $key) { - if ($key != 'user_action') { + if ($key !== 'user_action') { $possibleTriggers[$key] = trans('firefly.rule_trigger_' . $key . '_choice'); } } diff --git a/app/User.php b/app/User.php index 3c045f2412..da5e565d38 100644 --- a/app/User.php +++ b/app/User.php @@ -149,7 +149,7 @@ class User extends Authenticatable { foreach ($this->roles as $role) { - if ($role->name == $name) { + if ($role->name === $name) { return true; } } diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index cf4b60c3f9..e08c95a22a 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -211,7 +211,7 @@ class FireflyValidator extends Validator // count budgets, should have at least one $count = $budgets->filter( function (Budget $budget) use ($value) { - return $budget->name == $value; + return $budget->name === $value; } )->count(); @@ -329,7 +329,7 @@ class FireflyValidator extends Validator /** @var AccountMeta $entry */ foreach ($set as $entry) { - if ($entry->data == $value) { + if ($entry->data === $value) { return false; } @@ -398,7 +398,7 @@ class FireflyValidator extends Validator /** @var PiggyBank $entry */ foreach ($set as $entry) { $fieldValue = $this->tryDecrypt($entry->name); - if ($fieldValue == $value) { + if ($fieldValue === $value) { return false; } } @@ -460,7 +460,7 @@ class FireflyValidator extends Validator $set = $user->accounts()->where('account_type_id', $type->id)->get(); /** @var Account $entry */ foreach ($set as $entry) { - if ($entry->name == $value) { + if ($entry->name === $value) { return false; } } @@ -486,7 +486,7 @@ class FireflyValidator extends Validator $set = auth()->user()->accounts()->where('account_type_id', $type->id)->where('id', '!=', $ignore)->get(); /** @var Account $entry */ foreach ($set as $entry) { - if ($entry->name == $value) { + if ($entry->name === $value) { return false; } } @@ -510,7 +510,7 @@ class FireflyValidator extends Validator $set = auth()->user()->accounts()->where('account_type_id', $type->id)->where('id', '!=', $ignore)->get(); /** @var Account $entry */ foreach ($set as $entry) { - if ($entry->name == $value) { + if ($entry->name === $value) { return false; } } @@ -534,7 +534,7 @@ class FireflyValidator extends Validator $set = auth()->user()->accounts()->where('account_type_id', $type->id)->where('id', '!=', $ignore)->get(); /** @var Account $entry */ foreach ($set as $entry) { - if ($entry->name == $value) { + if ($entry->name === $value) { return false; } }