mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Code cleanup.
This commit is contained in:
@@ -43,8 +43,6 @@ class FixIbans extends Command
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
@@ -58,11 +56,6 @@ class FixIbans extends Command
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function filterIbans(Collection $accounts): void
|
||||
{
|
||||
/** @var Account $account */
|
||||
@@ -74,20 +67,16 @@ class FixIbans extends Command
|
||||
$account->iban = $iban;
|
||||
$account->save();
|
||||
$this->friendlyInfo(sprintf('Removed spaces from IBAN of account #%d', $account->id));
|
||||
$this->count++;
|
||||
++$this->count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function countAndCorrectIbans(Collection $accounts): void
|
||||
{
|
||||
$set = [];
|
||||
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
$userId = $account->user_id;
|
||||
@@ -103,9 +92,8 @@ class FixIbans extends Command
|
||||
if (array_key_exists($iban, $set[$userId])) {
|
||||
// iban already in use! two exceptions exist:
|
||||
if (
|
||||
!(AccountType::EXPENSE === $set[$userId][$iban] && AccountType::REVENUE === $type)
|
||||
&& // allowed combination
|
||||
!(AccountType::REVENUE === $set[$userId][$iban] && AccountType::EXPENSE === $type) // also allowed combination.
|
||||
!(AccountType::EXPENSE === $set[$userId][$iban] && AccountType::REVENUE === $type) // allowed combination
|
||||
&& !(AccountType::REVENUE === $set[$userId][$iban] && AccountType::EXPENSE === $type) // also allowed combination.
|
||||
) {
|
||||
$this->friendlyWarning(
|
||||
sprintf(
|
||||
@@ -118,7 +106,7 @@ class FixIbans extends Command
|
||||
);
|
||||
$account->iban = null;
|
||||
$account->save();
|
||||
$this->count++;
|
||||
++$this->count;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user