mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Big refactor to remove the deprecated transaction collector.
This commit is contained in:
@@ -58,7 +58,7 @@ class ChooseAccountsHandler implements BunqJobConfigurationInterface
|
||||
{
|
||||
$config = $this->repository->getConfiguration($this->importJob);
|
||||
$mapping = $config['mapping'] ?? [];
|
||||
$complete = \count($mapping) > 0;
|
||||
$complete = count($mapping) > 0;
|
||||
if (true === $complete) {
|
||||
// move job to correct stage to download transactions
|
||||
$this->repository->setStage($this->importJob, 'go-for-import');
|
||||
@@ -94,10 +94,10 @@ class ChooseAccountsHandler implements BunqJobConfigurationInterface
|
||||
*/
|
||||
$ibanToAsset = [];
|
||||
Log::debug('Going to map IBANs for easy mapping later on.');
|
||||
if (0 === \count($accounts)) {
|
||||
if (0 === count($accounts)) {
|
||||
throw new FireflyException('No bunq accounts found. Import cannot continue.'); // @codeCoverageIgnore
|
||||
}
|
||||
if (0 === \count($mapping)) {
|
||||
if (0 === count($mapping)) {
|
||||
$messages = new MessageBag;
|
||||
$messages->add('nomap', (string)trans('import.bunq_no_mapping'));
|
||||
|
||||
@@ -144,7 +144,7 @@ class ChooseAccountsHandler implements BunqJobConfigurationInterface
|
||||
{
|
||||
$config = $this->repository->getConfiguration($this->importJob);
|
||||
$accounts = $config['accounts'] ?? [];
|
||||
if (0 === \count($accounts)) {
|
||||
if (0 === count($accounts)) {
|
||||
throw new FireflyException('No bunq accounts found. Import cannot continue.'); // @codeCoverageIgnore
|
||||
}
|
||||
// list the users accounts:
|
||||
|
@@ -311,7 +311,7 @@ class ConfigureMappingHandler implements FileConfigurationInterface
|
||||
$columnConfig[$columnIndex]['values'] = array_unique($columnConfig[$columnIndex]['values']);
|
||||
asort($columnConfig[$columnIndex]['values']);
|
||||
// if the count of this array is zero, there is nothing to map.
|
||||
if (0 === \count($columnConfig[$columnIndex]['values'])) {
|
||||
if (0 === count($columnConfig[$columnIndex]['values'])) {
|
||||
unset($columnConfig[$columnIndex]);
|
||||
}
|
||||
}
|
||||
|
@@ -194,7 +194,7 @@ class ConfigureRolesHandler implements FileConfigurationInterface
|
||||
foreach ($records as $line) {
|
||||
$line = array_values($line);
|
||||
$line = $this->processSpecifics($config, $line);
|
||||
$count = \count($line);
|
||||
$count = count($line);
|
||||
$this->totalColumns = $count > $this->totalColumns ? $count : $this->totalColumns;
|
||||
$this->getExampleFromLine($line);
|
||||
}
|
||||
|
@@ -63,7 +63,7 @@ class ChooseAccountsHandler implements SpectreJobConfigurationInterface
|
||||
Log::debug('Now in ChooseAccountsHandler::configurationComplete()');
|
||||
$config = $this->importJob->configuration;
|
||||
$importAccounts = $config['account_mapping'] ?? [];
|
||||
$complete = \count($importAccounts) > 0 && $importAccounts !== [0 => 0];
|
||||
$complete = count($importAccounts) > 0 && $importAccounts !== [0 => 0];
|
||||
if ($complete) {
|
||||
Log::debug('Looks like user has mapped import accounts to Firefly III accounts', $importAccounts);
|
||||
$this->repository->setStage($this->importJob, 'go-for-import');
|
||||
@@ -98,7 +98,7 @@ class ChooseAccountsHandler implements SpectreJobConfigurationInterface
|
||||
$config['account_mapping'] = $final;
|
||||
$config['apply-rules'] = $applyRules;
|
||||
$this->repository->setConfiguration($this->importJob, $config);
|
||||
if ($final === [0 => 0] || 0 === \count($final)) {
|
||||
if ($final === [0 => 0] || 0 === count($final)) {
|
||||
$messages->add('count', (string)trans('import.spectre_no_mapping'));
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ class ChooseAccountsHandler implements SpectreJobConfigurationInterface
|
||||
Log::debug('Now in ChooseAccountsHandler::getnextData()');
|
||||
$config = $this->importJob->configuration;
|
||||
$accounts = $config['accounts'] ?? [];
|
||||
if (0 === \count($accounts)) {
|
||||
if (0 === count($accounts)) {
|
||||
throw new FireflyException('It seems you have no accounts with this bank. The import cannot continue.'); // @codeCoverageIgnore
|
||||
}
|
||||
$converted = [];
|
||||
@@ -129,7 +129,7 @@ class ChooseAccountsHandler implements SpectreJobConfigurationInterface
|
||||
$login = null;
|
||||
$logins = $config['all-logins'] ?? [];
|
||||
$selected = $config['selected-login'] ?? 0;
|
||||
if (0 === \count($logins)) {
|
||||
if (0 === count($logins)) {
|
||||
throw new FireflyException('It seems you have no configured logins in this import job. The import cannot continue.'); // @codeCoverageIgnore
|
||||
}
|
||||
Log::debug(sprintf('Selected login to use is %d', $selected));
|
||||
|
@@ -112,7 +112,7 @@ class ChooseLoginHandler implements SpectreJobConfigurationInterface
|
||||
$config = $this->importJob->configuration;
|
||||
$data = ['logins' => []];
|
||||
$logins = $config['all-logins'] ?? [];
|
||||
Log::debug(sprintf('Count of logins in configuration is %d.', \count($logins)));
|
||||
Log::debug(sprintf('Count of logins in configuration is %d.', count($logins)));
|
||||
foreach ($logins as $login) {
|
||||
$data['logins'][] = new Login($login);
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@ class SelectAccountsHandler implements YnabJobConfigurationInterface
|
||||
Log::debug('Now in SelectAccountsHandler::configurationComplete()');
|
||||
$config = $this->importJob->configuration;
|
||||
$mapping = $config['mapping'] ?? [];
|
||||
if (\count($mapping) > 0) {
|
||||
if (count($mapping) > 0) {
|
||||
// mapping is complete.
|
||||
Log::debug('Looks like user has mapped YNAB accounts to Firefly III accounts', $mapping);
|
||||
$this->repository->setStage($this->importJob, 'go-for-import');
|
||||
@@ -97,7 +97,7 @@ class SelectAccountsHandler implements YnabJobConfigurationInterface
|
||||
$config['mapping'] = $final;
|
||||
$config['apply-rules'] = $applyRules;
|
||||
$this->repository->setConfiguration($this->importJob, $config);
|
||||
if ($final === ['' => 0] || 0 === \count($final)) {
|
||||
if ($final === ['' => 0] || 0 === count($final)) {
|
||||
$messages->add('count', (string)trans('import.ynab_no_mapping'));
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ class SelectAccountsHandler implements YnabJobConfigurationInterface
|
||||
$config = $this->importJob->configuration;
|
||||
$ynabAccounts = $config['accounts'] ?? [];
|
||||
$budget = $this->getSelectedBudget();
|
||||
if (0 === \count($ynabAccounts)) {
|
||||
if (0 === count($ynabAccounts)) {
|
||||
throw new FireflyException('It seems you have no accounts with this budget. The import cannot continue.'); // @codeCoverageIgnore
|
||||
}
|
||||
// list the users accounts:
|
||||
|
@@ -104,7 +104,7 @@ class SelectBudgetHandler implements YnabJobConfigurationInterface
|
||||
$budgets = $configuration['budgets'] ?? [];
|
||||
$available = [];
|
||||
$notAvailable = [];
|
||||
$total = \count($budgets);
|
||||
$total = count($budgets);
|
||||
foreach ($budgets as $budget) {
|
||||
if ($this->haveAssetWithCurrency($budget['currency_code'])) {
|
||||
Log::debug('Add budget to available list.');
|
||||
|
Reference in New Issue
Block a user