mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-10 12:24:50 +00:00
Various code cleanup.
This commit is contained in:
@@ -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] || \count($final) === 0) {
|
||||
if ($final === [0 => 0] || 0 === \count($final)) {
|
||||
$messages->add('count', (string)trans('import.spectre_no_mapping'));
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ class ChooseAccountsHandler implements SpectreJobConfigurationInterface
|
||||
Log::debug('Now in ChooseAccountsHandler::getnextData()');
|
||||
$config = $this->importJob->configuration;
|
||||
$accounts = $config['accounts'] ?? [];
|
||||
if (\count($accounts) === 0) {
|
||||
if (0 === \count($accounts)) {
|
||||
throw new FireflyException('It seems you have no accounts with this bank. The import cannot continue.'); // @codeCoverageIgnore
|
||||
}
|
||||
$converted = [];
|
||||
@@ -128,15 +128,15 @@ class ChooseAccountsHandler implements SpectreJobConfigurationInterface
|
||||
$login = null;
|
||||
$logins = $config['all-logins'] ?? [];
|
||||
$selected = $config['selected-login'] ?? 0;
|
||||
if (\count($logins) === 0) {
|
||||
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));
|
||||
if ($selected === 0) {
|
||||
if (0 === $selected) {
|
||||
$login = new Login($logins[0]);
|
||||
Log::debug(sprintf('Will use login %d (%s %s)', $login->getId(), $login->getProviderName(), $login->getCountryCode()));
|
||||
}
|
||||
if ($selected !== 0) {
|
||||
if (0 !== $selected) {
|
||||
foreach ($logins as $loginArray) {
|
||||
$loginId = $loginArray['id'] ?? -1;
|
||||
if ($loginId === $selected) {
|
||||
|
||||
@@ -82,7 +82,7 @@ class ChooseLoginHandler implements SpectreJobConfigurationInterface
|
||||
Log::debug(sprintf('The selected login by the user is #%d', $selectedLogin));
|
||||
|
||||
// if selected login is zero, create a new one.
|
||||
if ($selectedLogin === 0) {
|
||||
if (0 === $selectedLogin) {
|
||||
Log::debug('Login is zero, get Spectre customer + token and store it in config.');
|
||||
$customer = $this->getCustomer($this->importJob);
|
||||
// get a token for the user and redirect to next stage
|
||||
|
||||
Reference in New Issue
Block a user