Some generic code refactoring.

This commit is contained in:
James Cole
2019-06-21 19:10:02 +02:00
parent fb1af395f9
commit 2d3d7f7720
67 changed files with 920 additions and 603 deletions

View File

@@ -50,7 +50,7 @@ class BankDebitCredit implements ConverterInterface
'Af', // ING (NL).
'Debet', // Triodos (NL)
];
if (\in_array(trim($value), $negative, true)) {
if (in_array(trim($value), $negative, true)) {
return -1;
}

View File

@@ -57,7 +57,7 @@ class AssetAccountIbans implements MapperInterface
$name = $account->iban . ' (' . $account->name . ')';
// is a liability?
if (\in_array($account->accountType->type, [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE], true)) {
if (in_array($account->accountType->type, [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE], true)) {
$name = $name . ' (' . strtolower(trans('import.import_liability_select')) . ')';
}
@@ -66,7 +66,7 @@ class AssetAccountIbans implements MapperInterface
if ('' === $iban) {
$name = $account->name;
// is a liability?
if (\in_array($account->accountType->type, [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE], true)) {
if (in_array($account->accountType->type, [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE], true)) {
$name = $name . ' (' . strtolower(trans('import.import_liability_select')) . ')';
}
$list[$accountId] = $name;

View File

@@ -55,7 +55,7 @@ class AssetAccounts implements MapperInterface
}
// is a liability?
if (\in_array($account->accountType->type, [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE], true)) {
if (in_array($account->accountType->type, [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE], true)) {
$name = trans('import.import_liability_select') . ': ' . $name;
}

View File

@@ -59,7 +59,7 @@ class OpposingAccountIbans implements MapperInterface
$name = $account->iban . ' (' . $account->name . ')';
// is a liability?
if (\in_array($account->accountType->type, [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE], true)) {
if (in_array($account->accountType->type, [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE], true)) {
$name = $name . ' (' . strtolower(trans('import.import_liability_select')) . ')';
}
@@ -69,7 +69,7 @@ class OpposingAccountIbans implements MapperInterface
if ('' === $iban) {
$name = $account->name;
// is a liability?
if (\in_array($account->accountType->type, [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE], true)) {
if (in_array($account->accountType->type, [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE], true)) {
$name = $name . ' (' . strtolower(trans('import.import_liability_select')) . ')';
}
$list[$accountId] = $name;

View File

@@ -59,7 +59,7 @@ class OpposingAccounts implements MapperInterface
$name .= ' (' . $iban . ')';
}
// is a liability?
if (\in_array($account->accountType->type, [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE], true)) {
if (in_array($account->accountType->type, [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE], true)) {
$name = trans('import.import_liability_select') . ': ' . $name;
}
$list[$accountId] = $name;

View File

@@ -52,7 +52,7 @@ class BunqRoutine implements RoutineInterface
{
Log::info(sprintf('Now in BunqRoutine::run() with status "%s" and stage "%s".', $this->importJob->status, $this->importJob->stage));
$valid = ['ready_to_run']; // should be only ready_to_run
if (\in_array($this->importJob->status, $valid, true)) {
if (in_array($this->importJob->status, $valid, true)) {
switch ($this->importJob->stage) {
default:
throw new FireflyException(sprintf('BunqRoutine cannot handle stage "%s".', $this->importJob->stage)); // @codeCoverageIgnore

View File

@@ -52,7 +52,7 @@ class FinTSRoutine implements RoutineInterface
{
Log::debug(sprintf('Now in FinTSRoutine::run() with status "%s" and stage "%s".', $this->importJob->status, $this->importJob->stage));
$valid = ['ready_to_run']; // should be only ready_to_run
if (\in_array($this->importJob->status, $valid, true)) {
if (in_array($this->importJob->status, $valid, true)) {
switch ($this->importJob->stage) {
default:
throw new FireflyException(sprintf('FinTSRoutine cannot handle stage "%s".', $this->importJob->stage)); // @codeCoverageIgnore

View File

@@ -56,7 +56,7 @@ class SpectreRoutine implements RoutineInterface
{
Log::debug(sprintf('Now in SpectreRoutine::run() with status "%s" and stage "%s".', $this->importJob->status, $this->importJob->stage));
$valid = ['ready_to_run']; // should be only ready_to_run
if (\in_array($this->importJob->status, $valid, true)) {
if (in_array($this->importJob->status, $valid, true)) {
switch ($this->importJob->stage) {
default:
throw new FireflyException(sprintf('SpectreRoutine cannot handle stage "%s".', $this->importJob->stage)); // @codeCoverageIgnore

View File

@@ -54,7 +54,7 @@ class YnabRoutine implements RoutineInterface
{
Log::debug(sprintf('Now in YNAB routine::run() with status "%s" and stage "%s".', $this->importJob->status, $this->importJob->stage));
$valid = ['ready_to_run']; // should be only ready_to_run
if (\in_array($this->importJob->status, $valid, true)) {
if (in_array($this->importJob->status, $valid, true)) {
// get access token from YNAB
if ('get_access_token' === $this->importJob->stage) {