diff --git a/app/Import/Converter/Amount.php b/app/Import/Converter/Amount.php index 4ee70cce4f..ee7630764d 100644 --- a/app/Import/Converter/Amount.php +++ b/app/Import/Converter/Amount.php @@ -26,6 +26,7 @@ use Log; /** * Class Amount. + * * @deprecated * @codeCoverageIgnore */ @@ -46,7 +47,7 @@ class Amount implements ConverterInterface } Log::debug(sprintf('Start with amount "%s"', $value)); $original = $value; - $value = $this->stripAmount((string)$value); + $value = $this->stripAmount((string) $value); $decimal = null; if ($this->decimalIsDot($value)) { @@ -219,7 +220,7 @@ class Amount implements ConverterInterface $value = substr($value, 2); } // have to strip the € because apparantly the Postbank (DE) thinks "1.000,00 €" is a normal way to format a number. - $value = trim((string)str_replace(['€'], '', $value)); + $value = trim((string) str_replace(['€'], '', $value)); $str = preg_replace('/[^\-\(\)\.\,0-9 ]/', '', $value); $len = strlen($str); if ('(' === $str[0] && ')' === $str[$len - 1]) { diff --git a/app/Import/Converter/AmountCredit.php b/app/Import/Converter/AmountCredit.php index 5d0f4d5c44..3bfb2e6021 100644 --- a/app/Import/Converter/AmountCredit.php +++ b/app/Import/Converter/AmountCredit.php @@ -24,6 +24,7 @@ namespace FireflyIII\Import\Converter; /** * Class AmountCredit + * * @deprecated * @codeCoverageIgnore */ diff --git a/app/Import/Converter/AmountDebit.php b/app/Import/Converter/AmountDebit.php index 403240a128..4b96a34662 100644 --- a/app/Import/Converter/AmountDebit.php +++ b/app/Import/Converter/AmountDebit.php @@ -24,6 +24,7 @@ namespace FireflyIII\Import\Converter; /** * Class AmountDebit + * * @deprecated * @codeCoverageIgnore */ diff --git a/app/Import/Converter/AmountNegated.php b/app/Import/Converter/AmountNegated.php index 690eaed6be..3bb2483e19 100644 --- a/app/Import/Converter/AmountNegated.php +++ b/app/Import/Converter/AmountNegated.php @@ -24,6 +24,7 @@ namespace FireflyIII\Import\Converter; /** * Class AmountNegated + * * @deprecated * @codeCoverageIgnore */ diff --git a/app/Import/Converter/BankDebitCredit.php b/app/Import/Converter/BankDebitCredit.php index e7c19265c2..4c5278ab5f 100644 --- a/app/Import/Converter/BankDebitCredit.php +++ b/app/Import/Converter/BankDebitCredit.php @@ -29,6 +29,7 @@ use Log; /** * * Class BankDebitCredit + * * @deprecated * @codeCoverageIgnore */ @@ -38,9 +39,10 @@ class BankDebitCredit implements ConverterInterface /** * Convert a value. * + * @param $value + * * @return mixed * - * @param $value */ public function convert($value): int { diff --git a/app/Import/Converter/ConverterInterface.php b/app/Import/Converter/ConverterInterface.php index 74343e2b50..bdf5176eb1 100644 --- a/app/Import/Converter/ConverterInterface.php +++ b/app/Import/Converter/ConverterInterface.php @@ -24,6 +24,7 @@ namespace FireflyIII\Import\Converter; /** * Interface ConverterInterface. + * * @deprecated * @codeCoverageIgnore */ @@ -32,9 +33,10 @@ interface ConverterInterface /** * Convert a value. * + * @param $value + * * @return mixed * - * @param $value */ public function convert($value); } diff --git a/app/Import/JobConfiguration/BunqJobConfiguration.php b/app/Import/JobConfiguration/BunqJobConfiguration.php index 74ba84c109..c4c5f3644b 100644 --- a/app/Import/JobConfiguration/BunqJobConfiguration.php +++ b/app/Import/JobConfiguration/BunqJobConfiguration.php @@ -34,6 +34,7 @@ use Log; /** * Class BunqJobConfiguration + * * @deprecated * @codeCoverageIgnore */ @@ -107,8 +108,8 @@ class BunqJobConfiguration implements JobConfigurationInterface /** * Get correct handler. * - * @return BunqJobConfigurationInterface * @throws FireflyException + * @return BunqJobConfigurationInterface */ private function getHandler(): BunqJobConfigurationInterface { diff --git a/app/Import/JobConfiguration/FakeJobConfiguration.php b/app/Import/JobConfiguration/FakeJobConfiguration.php index c4a3f8d0c9..132de1ef00 100644 --- a/app/Import/JobConfiguration/FakeJobConfiguration.php +++ b/app/Import/JobConfiguration/FakeJobConfiguration.php @@ -29,6 +29,7 @@ use Illuminate\Support\MessageBag; /** * Class FakeJobConfiguration + * * @deprecated * @codeCoverageIgnore */ @@ -78,7 +79,7 @@ class FakeJobConfiguration implements JobConfigurationInterface $artist = strtolower($data['artist'] ?? ''); $song = strtolower($data['song'] ?? ''); $album = strtolower($data['album'] ?? ''); - $applyRules = isset($data['apply_rules']) ? 1 === (int)$data['apply_rules'] : null; + $applyRules = isset($data['apply_rules']) ? 1 === (int) $data['apply_rules'] : null; $configuration = $this->importJob->configuration; if ('david bowie' === $artist) { // store artist @@ -118,8 +119,8 @@ class FakeJobConfiguration implements JobConfigurationInterface { return [ 'rulesOptions' => [ - 1 => (string)trans('firefly.yes'), - 0 => (string)trans('firefly.no'), + 1 => (string) trans('firefly.yes'), + 0 => (string) trans('firefly.no'), ], ]; } diff --git a/app/Import/JobConfiguration/FileJobConfiguration.php b/app/Import/JobConfiguration/FileJobConfiguration.php index 695c74a979..76cf4e2ec6 100644 --- a/app/Import/JobConfiguration/FileJobConfiguration.php +++ b/app/Import/JobConfiguration/FileJobConfiguration.php @@ -37,6 +37,7 @@ use Illuminate\Support\MessageBag; /** * Class FileJobConfiguration + * * @deprecated * @codeCoverageIgnore */ @@ -63,8 +64,8 @@ class FileJobConfiguration implements JobConfigurationInterface * * @param array $data * - * @return MessageBag * @throws FireflyException + * @return MessageBag */ public function configureJob(array $data): MessageBag { @@ -91,9 +92,9 @@ class FileJobConfiguration implements JobConfigurationInterface /** * Returns the view of the next step in the job configuration. * + * @throws FireflyException * @return string * - *@throws FireflyException */ public function getNextView(): string { @@ -130,9 +131,9 @@ class FileJobConfiguration implements JobConfigurationInterface /** * Get the configuration handler for this specific stage. * - * @return FileConfigurationInterface * @throws FireflyException * + * @return FileConfigurationInterface */ private function getConfigurationObject(): FileConfigurationInterface { diff --git a/app/Import/JobConfiguration/FinTSConfigurationSteps.php b/app/Import/JobConfiguration/FinTSConfigurationSteps.php index 0f198ec11a..4a55c548b3 100644 --- a/app/Import/JobConfiguration/FinTSConfigurationSteps.php +++ b/app/Import/JobConfiguration/FinTSConfigurationSteps.php @@ -26,6 +26,7 @@ namespace FireflyIII\Import\JobConfiguration; /** * * Class FinTSConfigurationSteps + * * @deprecated * @codeCoverageIgnore */ diff --git a/app/Import/JobConfiguration/FinTSJobConfiguration.php b/app/Import/JobConfiguration/FinTSJobConfiguration.php index d175dc9995..f7eb84bd95 100644 --- a/app/Import/JobConfiguration/FinTSJobConfiguration.php +++ b/app/Import/JobConfiguration/FinTSJobConfiguration.php @@ -32,6 +32,7 @@ use Illuminate\Support\MessageBag; /** * * Class FinTSJobConfiguration + * * @deprecated * @codeCoverageIgnore */ @@ -56,8 +57,8 @@ class FinTSJobConfiguration implements JobConfigurationInterface * * @param array $data * - * @return MessageBag * @throws FireflyException + * @return MessageBag */ public function configureJob(array $data): MessageBag { @@ -67,8 +68,8 @@ class FinTSJobConfiguration implements JobConfigurationInterface /** * Return the data required for the next step in the job configuration. * - * @return array * @throws FireflyException + * @return array */ public function getNextData(): array { @@ -78,8 +79,8 @@ class FinTSJobConfiguration implements JobConfigurationInterface /** * Returns the view of the next step in the job configuration. * - * @return string * @throws FireflyException + * @return string */ public function getNextView(): string { @@ -108,8 +109,8 @@ class FinTSJobConfiguration implements JobConfigurationInterface /** * Get the configuration handler for this specific stage. * - * @return FinTSConfigurationInterface * @throws FireflyException + * @return FinTSConfigurationInterface */ private function getConfigurationObject(): FinTSConfigurationInterface { diff --git a/app/Import/JobConfiguration/JobConfigurationInterface.php b/app/Import/JobConfiguration/JobConfigurationInterface.php index ad81d279c2..8d3343bb89 100644 --- a/app/Import/JobConfiguration/JobConfigurationInterface.php +++ b/app/Import/JobConfiguration/JobConfigurationInterface.php @@ -27,6 +27,7 @@ use Illuminate\Support\MessageBag; /** * Interface JobConfigurationInterface. + * * @deprecated * @codeCoverageIgnore */ diff --git a/app/Import/JobConfiguration/SpectreJobConfiguration.php b/app/Import/JobConfiguration/SpectreJobConfiguration.php index 22f7c3b29b..1bf3f12bdc 100644 --- a/app/Import/JobConfiguration/SpectreJobConfiguration.php +++ b/app/Import/JobConfiguration/SpectreJobConfiguration.php @@ -37,6 +37,7 @@ use Log; /** * Class SpectreJobConfiguration + * * @deprecated * @codeCoverageIgnore */ @@ -110,9 +111,9 @@ class SpectreJobConfiguration implements JobConfigurationInterface /** * Get correct handler. * - * @return SpectreJobConfigurationInterface * @throws FireflyException * + * @return SpectreJobConfigurationInterface */ private function getHandler(): SpectreJobConfigurationInterface { diff --git a/app/Import/JobConfiguration/YnabJobConfiguration.php b/app/Import/JobConfiguration/YnabJobConfiguration.php index 90e52acbb4..60ad0a52a9 100644 --- a/app/Import/JobConfiguration/YnabJobConfiguration.php +++ b/app/Import/JobConfiguration/YnabJobConfiguration.php @@ -35,6 +35,7 @@ use Log; /** * Class YnabJobConfiguration + * * @deprecated * @codeCoverageIgnore */ @@ -108,9 +109,9 @@ class YnabJobConfiguration implements JobConfigurationInterface /** * Get correct handler. * - * @return YnabJobConfigurationInterface * @throws FireflyException * + * @return YnabJobConfigurationInterface */ private function getHandler(): YnabJobConfigurationInterface { diff --git a/app/Import/Mapper/AssetAccountIbans.php b/app/Import/Mapper/AssetAccountIbans.php index 0c12576b95..b754f7d75a 100644 --- a/app/Import/Mapper/AssetAccountIbans.php +++ b/app/Import/Mapper/AssetAccountIbans.php @@ -28,6 +28,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; /** * Class AssetAccounts. + * * @deprecated * @codeCoverageIgnore */ @@ -54,7 +55,7 @@ class AssetAccountIbans implements MapperInterface /** @var Account $account */ foreach ($set as $account) { $iban = $account->iban ?? ''; - $accountId = (int)$account->id; + $accountId = (int) $account->id; if ('' !== $iban) { $name = $account->iban . ' (' . $account->name . ')'; @@ -77,7 +78,7 @@ class AssetAccountIbans implements MapperInterface /** @noinspection AdditionOperationOnArraysInspection */ $list = $topList + $list; asort($list); - $list = [0 => (string)trans('import.map_do_not_map')] + $list; + $list = [0 => (string) trans('import.map_do_not_map')] + $list; return $list; } diff --git a/app/Import/Mapper/AssetAccounts.php b/app/Import/Mapper/AssetAccounts.php index 7fef7fbda9..0d303977c2 100644 --- a/app/Import/Mapper/AssetAccounts.php +++ b/app/Import/Mapper/AssetAccounts.php @@ -28,6 +28,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; /** * Class AssetAccounts. + * * @deprecated * @codeCoverageIgnore */ @@ -49,7 +50,7 @@ class AssetAccounts implements MapperInterface /** @var Account $account */ foreach ($set as $account) { - $accountId = (int)$account->id; + $accountId = (int) $account->id; $name = $account->name; $iban = $account->iban ?? ''; if ('' !== $iban) { @@ -64,7 +65,7 @@ class AssetAccounts implements MapperInterface $list[$accountId] = $name; } asort($list); - $list = [0 => (string)trans('import.map_do_not_map')] + $list; + $list = [0 => (string) trans('import.map_do_not_map')] + $list; return $list; } diff --git a/app/Import/Mapper/Bills.php b/app/Import/Mapper/Bills.php index 3c41fa5006..5ba45bd3da 100644 --- a/app/Import/Mapper/Bills.php +++ b/app/Import/Mapper/Bills.php @@ -27,6 +27,7 @@ use FireflyIII\Repositories\Bill\BillRepositoryInterface; /** * Class Bills. + * * @deprecated * @codeCoverageIgnore */ @@ -46,11 +47,11 @@ class Bills implements MapperInterface /** @var Bill $bill */ foreach ($result as $bill) { - $billId = (int)$bill->id; + $billId = (int) $bill->id; $list[$billId] = $bill->name; } asort($list); - $list = [0 => (string)trans('import.map_do_not_map')] + $list; + $list = [0 => (string) trans('import.map_do_not_map')] + $list; return $list; } diff --git a/app/Import/Mapper/Budgets.php b/app/Import/Mapper/Budgets.php index 415a46b924..afe68219d6 100644 --- a/app/Import/Mapper/Budgets.php +++ b/app/Import/Mapper/Budgets.php @@ -27,6 +27,7 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; /** * Class Budgets. + * * @deprecated * @codeCoverageIgnore */ @@ -46,11 +47,11 @@ class Budgets implements MapperInterface /** @var Budget $budget */ foreach ($result as $budget) { - $budgetId = (int)$budget->id; + $budgetId = (int) $budget->id; $list[$budgetId] = $budget->name; } asort($list); - $list = [0 => (string)trans('import.map_do_not_map')] + $list; + $list = [0 => (string) trans('import.map_do_not_map')] + $list; return $list; } diff --git a/app/Import/Mapper/Categories.php b/app/Import/Mapper/Categories.php index eab0caf39e..2f398d6513 100644 --- a/app/Import/Mapper/Categories.php +++ b/app/Import/Mapper/Categories.php @@ -27,6 +27,7 @@ use FireflyIII\Repositories\Category\CategoryRepositoryInterface; /** * Class Categories. + * * @deprecated * @codeCoverageIgnore */ @@ -46,11 +47,11 @@ class Categories implements MapperInterface /** @var Category $category */ foreach ($result as $category) { - $categoryId = (int)$category->id; + $categoryId = (int) $category->id; $list[$categoryId] = $category->name; } asort($list); - $list = [0 => (string)trans('import.map_do_not_map')] + $list; + $list = [0 => (string) trans('import.map_do_not_map')] + $list; return $list; } diff --git a/app/Import/Mapper/MapperInterface.php b/app/Import/Mapper/MapperInterface.php index 047aa6c1b3..be211d418b 100644 --- a/app/Import/Mapper/MapperInterface.php +++ b/app/Import/Mapper/MapperInterface.php @@ -24,6 +24,7 @@ namespace FireflyIII\Import\Mapper; /** * Interface MapperInterface. + * * @deprecated * @codeCoverageIgnore */ diff --git a/app/Import/Mapper/OpposingAccountIbans.php b/app/Import/Mapper/OpposingAccountIbans.php index 8512721067..117e5db0fd 100644 --- a/app/Import/Mapper/OpposingAccountIbans.php +++ b/app/Import/Mapper/OpposingAccountIbans.php @@ -28,6 +28,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; /** * Class OpposingAccounts. + * * @deprecated * @codeCoverageIgnore */ @@ -56,7 +57,7 @@ class OpposingAccountIbans implements MapperInterface /** @var Account $account */ foreach ($set as $account) { $iban = $account->iban ?? ''; - $accountId = (int)$account->id; + $accountId = (int) $account->id; if ('' !== $iban) { $name = $account->iban . ' (' . $account->name . ')'; @@ -80,7 +81,7 @@ class OpposingAccountIbans implements MapperInterface /** @noinspection AdditionOperationOnArraysInspection */ $list = $topList + $list; asort($list); - $list = [0 => (string)trans('import.map_do_not_map')] + $list; + $list = [0 => (string) trans('import.map_do_not_map')] + $list; return $list; } diff --git a/app/Import/Mapper/OpposingAccounts.php b/app/Import/Mapper/OpposingAccounts.php index 51db102b4d..99453cadeb 100644 --- a/app/Import/Mapper/OpposingAccounts.php +++ b/app/Import/Mapper/OpposingAccounts.php @@ -28,6 +28,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; /** * Class OpposingAccounts. + * * @deprecated * @codeCoverageIgnore * @@ -55,7 +56,7 @@ class OpposingAccounts implements MapperInterface /** @var Account $account */ foreach ($set as $account) { - $accountId = (int)$account->id; + $accountId = (int) $account->id; $name = $account->name; $iban = $account->iban ?? ''; if ('' !== $iban) { @@ -68,7 +69,7 @@ class OpposingAccounts implements MapperInterface $list[$accountId] = $name; } asort($list); - $list = [0 => (string)trans('import.map_do_not_map')] + $list; + $list = [0 => (string) trans('import.map_do_not_map')] + $list; return $list; } diff --git a/app/Import/Mapper/Tags.php b/app/Import/Mapper/Tags.php index d7355b9e09..ea02687994 100644 --- a/app/Import/Mapper/Tags.php +++ b/app/Import/Mapper/Tags.php @@ -27,6 +27,7 @@ use FireflyIII\Repositories\Tag\TagRepositoryInterface; /** * Class Tags. + * * @deprecated * @codeCoverageIgnore */ @@ -46,11 +47,11 @@ class Tags implements MapperInterface /** @var Tag $tag */ foreach ($result as $tag) { - $tagId = (int)$tag->id; + $tagId = (int) $tag->id; $list[$tagId] = $tag->tag; } asort($list); - $list = [0 => (string)trans('import.map_do_not_map')] + $list; + $list = [0 => (string) trans('import.map_do_not_map')] + $list; return $list; } diff --git a/app/Import/Mapper/TransactionCurrencies.php b/app/Import/Mapper/TransactionCurrencies.php index 49871996a4..613afcc54d 100644 --- a/app/Import/Mapper/TransactionCurrencies.php +++ b/app/Import/Mapper/TransactionCurrencies.php @@ -26,6 +26,7 @@ use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; /** * Class TransactionCurrencies. + * * @deprecated * @codeCoverageIgnore */ @@ -43,12 +44,12 @@ class TransactionCurrencies implements MapperInterface $currencies = $repository->get(); $list = []; foreach ($currencies as $currency) { - $currencyId = (int)$currency->id; + $currencyId = (int) $currency->id; $list[$currencyId] = $currency->name . ' (' . $currency->code . ')'; } asort($list); - $list = [0 => (string)trans('import.map_do_not_map')] + $list; + $list = [0 => (string) trans('import.map_do_not_map')] + $list; return $list; } diff --git a/app/Import/MapperPreProcess/PreProcessorInterface.php b/app/Import/MapperPreProcess/PreProcessorInterface.php index c51583fd18..9436db4078 100644 --- a/app/Import/MapperPreProcess/PreProcessorInterface.php +++ b/app/Import/MapperPreProcess/PreProcessorInterface.php @@ -24,6 +24,7 @@ namespace FireflyIII\Import\MapperPreProcess; /** * Interface PreProcessorInterface. + * * @deprecated * @codeCoverageIgnore */ diff --git a/app/Import/MapperPreProcess/TagsComma.php b/app/Import/MapperPreProcess/TagsComma.php index a15ab82917..23427f02cc 100644 --- a/app/Import/MapperPreProcess/TagsComma.php +++ b/app/Import/MapperPreProcess/TagsComma.php @@ -24,6 +24,7 @@ namespace FireflyIII\Import\MapperPreProcess; /** * Class TagsComma. + * * @deprecated * @codeCoverageIgnore */ diff --git a/app/Import/MapperPreProcess/TagsSpace.php b/app/Import/MapperPreProcess/TagsSpace.php index 3d5402277c..bab216c2a1 100644 --- a/app/Import/MapperPreProcess/TagsSpace.php +++ b/app/Import/MapperPreProcess/TagsSpace.php @@ -24,6 +24,7 @@ namespace FireflyIII\Import\MapperPreProcess; /** * Class TagsSpace. + * * @deprecated * @codeCoverageIgnore */ diff --git a/app/Import/Prerequisites/BunqPrerequisites.php b/app/Import/Prerequisites/BunqPrerequisites.php index 5dff898c62..664f3aba84 100644 --- a/app/Import/Prerequisites/BunqPrerequisites.php +++ b/app/Import/Prerequisites/BunqPrerequisites.php @@ -33,6 +33,7 @@ use Log; /** * This class contains all the routines necessary to connect to Bunq. + * * @deprecated * @codeCoverageIgnore */ @@ -82,7 +83,7 @@ class BunqPrerequisites implements PrerequisitesInterface if (!$this->hasExternalIP()) { /** @var IPRetrievalInterface $service */ $service = app(IPRetrievalInterface::class); - $externalIP = (string)$service->getIP(); + $externalIP = (string) $service->getIP(); } return ['api_key' => $key, 'external_ip' => $externalIP]; @@ -190,7 +191,7 @@ class BunqPrerequisites implements PrerequisitesInterface if (null === $apiContext) { return false; } - if ('' === (string)$apiContext->data) { + if ('' === (string) $apiContext->data) { return false; } @@ -208,7 +209,7 @@ class BunqPrerequisites implements PrerequisitesInterface if (null === $apiKey) { return false; } - if ('' === (string)$apiKey->data) { + if ('' === (string) $apiKey->data) { return false; } @@ -226,7 +227,7 @@ class BunqPrerequisites implements PrerequisitesInterface if (null === $externalIP) { return false; } - if ('' === (string)$externalIP->data) { + if ('' === (string) $externalIP->data) { return false; } diff --git a/app/Import/Prerequisites/FakePrerequisites.php b/app/Import/Prerequisites/FakePrerequisites.php index f17650b499..8f7ef94cb2 100644 --- a/app/Import/Prerequisites/FakePrerequisites.php +++ b/app/Import/Prerequisites/FakePrerequisites.php @@ -25,11 +25,13 @@ namespace FireflyIII\Import\Prerequisites; use FireflyIII\User; use Illuminate\Support\MessageBag; use Log; +use function request; /** * This class contains all the routines necessary for the fake import provider. * * Class FakePrerequisites + * * @deprecated * @codeCoverageIgnore */ @@ -70,9 +72,9 @@ class FakePrerequisites implements PrerequisitesInterface if ($this->hasApiKey()) { $apiKey = app('preferences')->getForUser($this->user, 'fake_api_key', null)->data; } - $oldKey = (string)\request()->old('api_key'); + $oldKey = (string) request()->old('api_key'); if ('' !== $oldKey) { - $apiKey = \request()->old('api_key'); // @codeCoverageIgnore + $apiKey = request()->old('api_key'); // @codeCoverageIgnore } return ['api_key' => $apiKey]; @@ -135,7 +137,7 @@ class FakePrerequisites implements PrerequisitesInterface if (null === $apiKey->data) { return false; } - if (32 === strlen((string)$apiKey->data)) { + if (32 === strlen((string) $apiKey->data)) { return true; } diff --git a/app/Import/Prerequisites/FilePrerequisites.php b/app/Import/Prerequisites/FilePrerequisites.php index 6aaec20b42..8cfc105182 100644 --- a/app/Import/Prerequisites/FilePrerequisites.php +++ b/app/Import/Prerequisites/FilePrerequisites.php @@ -45,6 +45,7 @@ class FilePrerequisites implements PrerequisitesInterface Log::warning(sprintf('%s should not be instantiated in the TEST environment!', get_class($this))); } } + /** * Returns view name that allows user to fill in prerequisites. * diff --git a/app/Import/Prerequisites/PrerequisitesInterface.php b/app/Import/Prerequisites/PrerequisitesInterface.php index 0feeaa42d0..4ac3992b6e 100644 --- a/app/Import/Prerequisites/PrerequisitesInterface.php +++ b/app/Import/Prerequisites/PrerequisitesInterface.php @@ -27,6 +27,7 @@ use Illuminate\Support\MessageBag; /** * Interface PrerequisitesInterface + * * @deprecated * @codeCoverageIgnore */ diff --git a/app/Import/Prerequisites/SpectrePrerequisites.php b/app/Import/Prerequisites/SpectrePrerequisites.php index d24dc4eada..2746c870bf 100644 --- a/app/Import/Prerequisites/SpectrePrerequisites.php +++ b/app/Import/Prerequisites/SpectrePrerequisites.php @@ -29,6 +29,7 @@ use Log; /** * This class contains all the routines necessary to connect to Spectre. + * * @deprecated * @codeCoverageIgnore */ @@ -178,7 +179,7 @@ class SpectrePrerequisites implements PrerequisitesInterface if (null === $appId) { return false; } - if ('' === (string)$appId->data) { + if ('' === (string) $appId->data) { return false; } @@ -196,7 +197,7 @@ class SpectrePrerequisites implements PrerequisitesInterface if (null === $secret) { return false; } - if ('' === (string)$secret->data) { + if ('' === (string) $secret->data) { return false; } diff --git a/app/Import/Prerequisites/YnabPrerequisites.php b/app/Import/Prerequisites/YnabPrerequisites.php index 0e18b3f864..234ea3201f 100644 --- a/app/Import/Prerequisites/YnabPrerequisites.php +++ b/app/Import/Prerequisites/YnabPrerequisites.php @@ -29,6 +29,7 @@ use Log; /** * Class YnabPrerequisites + * * @deprecated * @codeCoverageIgnore */ @@ -131,7 +132,7 @@ class YnabPrerequisites implements PrerequisitesInterface if (null === $clientId) { return false; } - if ('' === (string)$clientId->data) { + if ('' === (string) $clientId->data) { return false; } @@ -149,7 +150,7 @@ class YnabPrerequisites implements PrerequisitesInterface if (null === $clientSecret) { return false; } - if ('' === (string)$clientSecret->data) { + if ('' === (string) $clientSecret->data) { return false; } diff --git a/app/Import/Routine/BunqRoutine.php b/app/Import/Routine/BunqRoutine.php index 9e1ef123c8..c70e425936 100644 --- a/app/Import/Routine/BunqRoutine.php +++ b/app/Import/Routine/BunqRoutine.php @@ -32,6 +32,7 @@ use Log; /** * Class BunqRoutine + * * @deprecated * @codeCoverageIgnore */ diff --git a/app/Import/Routine/FakeRoutine.php b/app/Import/Routine/FakeRoutine.php index 6774a03116..8e81b8fe4a 100644 --- a/app/Import/Routine/FakeRoutine.php +++ b/app/Import/Routine/FakeRoutine.php @@ -33,6 +33,7 @@ use Log; /** * Class FakeRoutine + * * @deprecated * @codeCoverageIgnore */ @@ -51,9 +52,9 @@ class FakeRoutine implements RoutineInterface * "ahoy": will log some nonsense and then drop job into status:"need_job_config" to force it back to the job config routine. * "final": will do some logging, sleep for 10 seconds and then finish. Generates 5 random transactions. * - * @return void * @throws FireflyException * + * @return void */ public function run(): void { diff --git a/app/Import/Routine/FileRoutine.php b/app/Import/Routine/FileRoutine.php index f058360e23..c54d71b911 100644 --- a/app/Import/Routine/FileRoutine.php +++ b/app/Import/Routine/FileRoutine.php @@ -30,6 +30,7 @@ use Log; /** * Class FileRoutine + * * @deprecated * @codeCoverageIgnore */ diff --git a/app/Import/Routine/FinTSRoutine.php b/app/Import/Routine/FinTSRoutine.php index 0b21d95e13..6cb2f72f11 100644 --- a/app/Import/Routine/FinTSRoutine.php +++ b/app/Import/Routine/FinTSRoutine.php @@ -33,6 +33,7 @@ use Illuminate\Support\Facades\Log; /** * * Class FinTSRoutine + * * @deprecated * @codeCoverageIgnore */ diff --git a/app/Import/Routine/RoutineInterface.php b/app/Import/Routine/RoutineInterface.php index 61a26e19bf..8d02979e06 100644 --- a/app/Import/Routine/RoutineInterface.php +++ b/app/Import/Routine/RoutineInterface.php @@ -27,6 +27,7 @@ use FireflyIII\Models\ImportJob; /** * Interface RoutineInterface + * * @deprecated * @codeCoverageIgnore */ diff --git a/app/Import/Routine/SpectreRoutine.php b/app/Import/Routine/SpectreRoutine.php index 81c67c6e94..984ef19c68 100644 --- a/app/Import/Routine/SpectreRoutine.php +++ b/app/Import/Routine/SpectreRoutine.php @@ -32,6 +32,7 @@ use Log; /** * Class SpectreRoutine + * * @deprecated * @codeCoverageIgnore */ diff --git a/app/Import/Routine/YnabRoutine.php b/app/Import/Routine/YnabRoutine.php index 3807f46b03..5b2cd57197 100644 --- a/app/Import/Routine/YnabRoutine.php +++ b/app/Import/Routine/YnabRoutine.php @@ -34,6 +34,7 @@ use Log; /** * Class YnabRoutine + * * @deprecated * @codeCoverageIgnore */ diff --git a/app/Import/Specifics/AbnAmroDescription.php b/app/Import/Specifics/AbnAmroDescription.php index 6f5a946dd3..d15d42e35d 100644 --- a/app/Import/Specifics/AbnAmroDescription.php +++ b/app/Import/Specifics/AbnAmroDescription.php @@ -24,6 +24,7 @@ namespace FireflyIII\Import\Specifics; /** * Class AbnAmroDescription. + * * @deprecated * @codeCoverageIgnore * @@ -81,7 +82,7 @@ class AbnAmroDescription implements SpecificInterface // If the description could not be parsed, specify an unknown opposing // account, as an opposing account is required if (!$parsed) { - $this->row[8] = (string)trans('firefly.unknown'); // opposing-account-name + $this->row[8] = (string) trans('firefly.unknown'); // opposing-account-name } return $this->row; diff --git a/app/Import/Specifics/Belfius.php b/app/Import/Specifics/Belfius.php index ba6e9f9df8..cc208eab31 100644 --- a/app/Import/Specifics/Belfius.php +++ b/app/Import/Specifics/Belfius.php @@ -24,6 +24,7 @@ namespace FireflyIII\Import\Specifics; /** * Class Belfius. + * * @deprecated * @codeCoverageIgnore * @@ -56,19 +57,6 @@ class Belfius implements SpecificInterface return 'import.specific_belfius_name'; } - /** - * Run the fix. - * - * @param array $row - * - * @return array - * - */ - public function run(array $row): array - { - return Belfius::processRecurringTransactionDescription($row); - } - /** * Fixes the description for outgoing recurring transactions so doubles can be detected when the equivalent incoming * transaction is imported for another bank account. @@ -82,7 +70,7 @@ class Belfius implements SpecificInterface } $opposingAccountName = $row[5]; - $description = $row[14]; + $description = $row[14]; preg_match('/DOORLOPENDE OPDRACHT.*\s+' . preg_quote($opposingAccountName, '/') . '\s+(.+)\s+REF.\s*:/', $description, $matches); @@ -92,4 +80,17 @@ class Belfius implements SpecificInterface return $row; } + + /** + * Run the fix. + * + * @param array $row + * + * @return array + * + */ + public function run(array $row): array + { + return Belfius::processRecurringTransactionDescription($row); + } } diff --git a/app/Import/Specifics/IngBelgium.php b/app/Import/Specifics/IngBelgium.php index 4161f4e6ac..f31ce7b6c6 100644 --- a/app/Import/Specifics/IngBelgium.php +++ b/app/Import/Specifics/IngBelgium.php @@ -24,6 +24,7 @@ namespace FireflyIII\Import\Specifics; /** * Class IngBelgium. + * * @deprecated * @codeCoverageIgnore * @@ -55,33 +56,26 @@ class IngBelgium implements SpecificInterface } /** - * Run the specific code. - * - * @param array $row - * - * @return array + * Gets the description from the transaction details and makes sure structured descriptions are in the + * "+++090/9337/55493+++" format. * + * @return string the description */ - public function run(array $row): array + protected static function description(string $transactionDetails): string { - return IngBelgium::processTransactionDetails($row); + $description = IngBelgium::parseInformationFromTransactionDetails($transactionDetails, '/Mededeling:\s*(.+)$/'); + + return IngBelgium::convertStructuredDescriptionToProperFormat($description); } /** - * Gets the description and opposing account information (IBAN and name) from the transaction details and adds - * them to the row of data. + * Gets the opposing account's IBAN from the transaction details. * - * @return array the row containing the description and opposing account's IBAN + * @return string the opposing account's IBAN */ - protected static function processTransactionDetails(array $row): array + protected static function opposingAccountIban(string $transactionDetails): string { - if(isset($row[9])) { - $transactionDetails = $row[9]; - $row[11] = IngBelgium::opposingAccountName($transactionDetails); - $row[12] = IngBelgium::opposingAccountIban($transactionDetails); - $row[13] = IngBelgium::description($transactionDetails); - } - return $row; + return IngBelgium::parseInformationFromTransactionDetails($transactionDetails, '/IBAN:\s*(.+?)(?=\s+)/'); } /** @@ -96,39 +90,36 @@ class IngBelgium implements SpecificInterface } /** - * Gets the opposing account's IBAN from the transaction details. + * Gets the description and opposing account information (IBAN and name) from the transaction details and adds + * them to the row of data. * - * @return string the opposing account's IBAN + * @return array the row containing the description and opposing account's IBAN */ - protected static function opposingAccountIban(string $transactionDetails): string + protected static function processTransactionDetails(array $row): array { - return IngBelgium::parseInformationFromTransactionDetails($transactionDetails, '/IBAN:\s*(.+?)(?=\s+)/'); - } + if (isset($row[9])) { + $transactionDetails = $row[9]; + $row[11] = IngBelgium::opposingAccountName($transactionDetails); + $row[12] = IngBelgium::opposingAccountIban($transactionDetails); + $row[13] = IngBelgium::description($transactionDetails); + } - /** - * Gets the description from the transaction details and makes sure structured descriptions are in the - * "+++090/9337/55493+++" format. - * - * @return string the description - */ - protected static function description(string $transactionDetails): string - { - $description = IngBelgium::parseInformationFromTransactionDetails($transactionDetails, '/Mededeling:\s*(.+)$/'); - return IngBelgium::convertStructuredDescriptionToProperFormat($description); + return $row; } private static function convertStructuredDescriptionToProperFormat(string $description): string { preg_match('/^\*\*\*(\d{3}\/\d{4}\/\d{5})\*\*\*$/', $description, $matches); - if(isset($matches[1])) { + if (isset($matches[1])) { return '+++' . $matches[1] . '+++'; } + return $description; } private static function parseInformationFromTransactionDetails(string $transactionDetails, string $regex): string { - if(isset($transactionDetails)) { + if (isset($transactionDetails)) { preg_match($regex, $transactionDetails, $matches); if (isset($matches[1])) { return trim($matches[1]); @@ -137,4 +128,17 @@ class IngBelgium implements SpecificInterface return ''; } + + /** + * Run the specific code. + * + * @param array $row + * + * @return array + * + */ + public function run(array $row): array + { + return IngBelgium::processTransactionDetails($row); + } } diff --git a/app/Import/Specifics/IngDescription.php b/app/Import/Specifics/IngDescription.php index 510a08ce39..26cdf47c8d 100644 --- a/app/Import/Specifics/IngDescription.php +++ b/app/Import/Specifics/IngDescription.php @@ -24,6 +24,7 @@ namespace FireflyIII\Import\Specifics; /** * Class IngDescription. + * * @deprecated * @codeCoverageIgnore * @@ -106,11 +107,14 @@ class IngDescription implements SpecificInterface } /** - * Remove "Omschrijving" (and NOT its value) from the description. + * Move "Valutadatum" from the description to new column. */ - protected function removeIngDescription(): void + protected function moveValutadatumDescription(): void { - $this->row[8] = preg_replace('/Omschrijving: /', '', $this->row[8]); + $matches = []; + preg_match('/Valutadatum: ([0-9-]+)/', $this->row[8], $matches); + $this->row[9] = date("Ymd", strtotime($matches[1])); + $this->row[8] = preg_replace('/Valutadatum: [0-9-]+/', '', $this->row[8]); } /** @@ -123,6 +127,14 @@ class IngDescription implements SpecificInterface $this->row[8] = preg_replace('/\sIBAN:\s' . $this->row[3] . '/', '', $this->row[8]); } + /** + * Remove "Omschrijving" (and NOT its value) from the description. + */ + protected function removeIngDescription(): void + { + $this->row[8] = preg_replace('/Omschrijving: /', '', $this->row[8]); + } + /** * Remove "Naam" (and its value) from the description. */ @@ -131,31 +143,20 @@ class IngDescription implements SpecificInterface $this->row[8] = preg_replace('/Naam:.*?([a-zA-Z\/]+:)/', '$1', $this->row[8]); } - /** - * Move "Valutadatum" from the description to new column. - */ - protected function moveValutadatumDescription(): void - { - $matches = array(); - preg_match('/Valutadatum: ([0-9-]+)/', $this->row[8], $matches); - $this->row[9] = date("Ymd", strtotime($matches[1])); - $this->row[8] = preg_replace('/Valutadatum: [0-9-]+/', '', $this->row[8]); - } - /** * Move savings account number to column 1 and name to column 3. */ private function MoveSavingsAccount(): void { - $matches = array(); - if ('' === (string)$this->row[3]) { + $matches = []; + if ('' === (string) $this->row[3]) { if (preg_match('/(Naar|Van) (.*rekening) ([0-9]+)/', $this->row[8], $matches)) { - $matches[3] = sprintf("%010d", $matches[3]); + $matches[3] = sprintf("%010d", $matches[3]); $this->row[1] = $matches[2]; // Savings account name $this->row[3] = $matches[3]; // Savings account number $this->row[8] = preg_replace('/(Naar|Van) (.*rekening) ([0-9]+)/', '', $this->row[8]); // Remove the savings account content from description } elseif (preg_match('/(Naar|Van) (.*rekening) ([0-9]+)/', $this->row[1], $matches)) { - $matches[3] = sprintf("%010d", $matches[3]); + $matches[3] = sprintf("%010d", $matches[3]); $this->row[1] = $matches[2]; // Savings account name $this->row[3] = $matches[3]; // Savings account number } diff --git a/app/Import/Specifics/PresidentsChoice.php b/app/Import/Specifics/PresidentsChoice.php index e7ecf495ef..36abe52657 100644 --- a/app/Import/Specifics/PresidentsChoice.php +++ b/app/Import/Specifics/PresidentsChoice.php @@ -24,6 +24,7 @@ namespace FireflyIII\Import\Specifics; /** * Class PresidentsChoice. + * * @deprecated * @codeCoverageIgnore */ diff --git a/app/Import/Specifics/SnsDescription.php b/app/Import/Specifics/SnsDescription.php index f67cc45e82..f36a683ee5 100644 --- a/app/Import/Specifics/SnsDescription.php +++ b/app/Import/Specifics/SnsDescription.php @@ -24,6 +24,7 @@ namespace FireflyIII\Import\Specifics; /** * Class SnsDescription. + * * @codeCoverageIgnore * @deprecated */ diff --git a/app/Import/Specifics/SpecificInterface.php b/app/Import/Specifics/SpecificInterface.php index 1c235e58e5..b2a9a6e5fa 100644 --- a/app/Import/Specifics/SpecificInterface.php +++ b/app/Import/Specifics/SpecificInterface.php @@ -24,6 +24,7 @@ namespace FireflyIII\Import\Specifics; /** * Interface SpecificInterface. + * * @codeCoverageIgnore * @deprecated */ diff --git a/app/Import/Storage/ImportArrayStorage.php b/app/Import/Storage/ImportArrayStorage.php index 886d9a9b11..c73ec54186 100644 --- a/app/Import/Storage/ImportArrayStorage.php +++ b/app/Import/Storage/ImportArrayStorage.php @@ -32,17 +32,14 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\ImportJob; use FireflyIII\Models\Preference; -use FireflyIII\Models\Rule; use FireflyIII\Models\TransactionGroup; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; -use FireflyIII\Repositories\Rule\RuleRepositoryInterface; use FireflyIII\Repositories\Tag\TagRepositoryInterface; use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface; use FireflyIII\TransactionRules\Engine\RuleEngine; -use FireflyIII\TransactionRules\Processor; use Illuminate\Database\QueryException; use Illuminate\Support\Collection; use Log; @@ -51,6 +48,7 @@ use Log; * Creates new transactions based on arrays. * * Class ImportArrayStorage + * * @codeCoverageIgnore * @deprecated * @@ -107,8 +105,8 @@ class ImportArrayStorage * - Link to tag * - Run rules (if set to) * - * @return Collection * @throws FireflyException + * @return Collection */ public function store(): Collection { @@ -133,7 +131,7 @@ class ImportArrayStorage app('preferences')->mark(); // email about this: - event(new RequestedReportOnJournals((int)$this->importJob->user_id, $collection)); + event(new RequestedReportOnJournals((int) $this->importJob->user_id, $collection)); return $collection; } @@ -218,7 +216,7 @@ class ImportArrayStorage $hash = $this->getHash($transaction); $existingId = $this->hashExists($hash); if (null !== $existingId) { - $message = (string)trans('import.duplicate_row', ['row' => $index, 'description' => $transaction['description']]); + $message = (string) trans('import.duplicate_row', ['row' => $index, 'description' => $transaction['description']]); $this->logDuplicateObject($transaction, $existingId); $this->repository->addErrorMessage($this->importJob, $message); @@ -227,7 +225,7 @@ class ImportArrayStorage // do transfer detection: if ($this->checkForTransfers && $this->transferExists($transaction)) { - $message = (string)trans('import.duplicate_row', ['row' => $index, 'description' => $transaction['description']]); + $message = (string) trans('import.duplicate_row', ['row' => $index, 'description' => $transaction['description']]); $this->logDuplicateTransfer($transaction); $this->repository->addErrorMessage($this->importJob, $message); @@ -321,7 +319,7 @@ class ImportArrayStorage } Log::info(sprintf('Found a transaction journal with an existing hash: %s', $hash)); - return (int)$entry->transaction_journal_id; + return (int) $entry->transaction_journal_id; } /** @@ -338,7 +336,7 @@ class ImportArrayStorage $repository = app(TagRepositoryInterface::class); $repository->setUser($this->importJob->user); $data = [ - 'tag' => (string)trans('import.import_with_key', ['key' => $this->importJob->key]), + 'tag' => (string) trans('import.import_with_key', ['key' => $this->importJob->key]), 'date' => new Carbon, 'description' => null, 'latitude' => null, @@ -475,9 +473,9 @@ class ImportArrayStorage /** * Store array as journals. * - * @return Collection * @throws FireflyException * + * @return Collection */ private function storeGroupArray(): Collection { @@ -531,21 +529,21 @@ class ImportArrayStorage // get the amount: /** @noinspection UnnecessaryCastingInspection */ - $amount = (string)($transaction['amount'] ?? '0'); + $amount = (string) ($transaction['amount'] ?? '0'); if (bccomp($amount, '0') === -1) { $amount = bcmul($amount, '-1'); // @codeCoverageIgnore } // get the description: //$description = '' === (string)$transaction['description'] ? $transaction['description'] : $transaction['description']; - $description = (string)$transaction['description']; + $description = (string) $transaction['description']; // get the source and destination ID's: - $transactionSourceIDs = [(int)$transaction['source_id'], (int)$transaction['destination_id']]; + $transactionSourceIDs = [(int) $transaction['source_id'], (int) $transaction['destination_id']]; sort($transactionSourceIDs); // get the source and destination names: - $transactionSourceNames = [(string)$transaction['source_name'], (string)$transaction['destination_name']]; + $transactionSourceNames = [(string) $transaction['source_name'], (string) $transaction['destination_name']]; sort($transactionSourceNames); // then loop all transfers: @@ -587,7 +585,7 @@ class ImportArrayStorage Log::debug(sprintf('Comparison is a hit! (%s)', $hits)); // compare source and destination id's - $transferSourceIDs = [(int)$transfer['source_account_id'], (int)$transfer['destination_account_id']]; + $transferSourceIDs = [(int) $transfer['source_account_id'], (int) $transfer['destination_account_id']]; sort($transferSourceIDs); /** @noinspection DisconnectedForeachInstructionInspection */ Log::debug('Comparing current transaction source+dest IDs', $transactionSourceIDs); @@ -602,7 +600,7 @@ class ImportArrayStorage unset($transferSourceIDs); // compare source and destination names - $transferSource = [(string)($transfer['source_account_name'] ?? ''), (string)($transfer['destination_account_name'] ?? '')]; + $transferSource = [(string) ($transfer['source_account_name'] ?? ''), (string) ($transfer['destination_account_name'] ?? '')]; sort($transferSource); /** @noinspection DisconnectedForeachInstructionInspection */ Log::debug('Comparing current transaction source+dest names', $transactionSourceNames);