Code cleanup.

This commit is contained in:
James Cole
2021-03-28 11:43:07 +02:00
parent 5abbb8a807
commit 2c575f3ca5
379 changed files with 304 additions and 1727 deletions

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Correction;
use Artisan;
use Illuminate\Console\Command;
use Schema;
@@ -48,7 +47,6 @@ class CorrectDatabase extends Command
*/
protected $signature = 'firefly-iii:correct-database';
/**
* Execute the console command.
*/

View File

@@ -53,7 +53,6 @@ class CorrectOpeningBalanceCurrencies extends Command
*/
protected $signature = 'firefly-iii:fix-ob-currencies';
/**
* Execute the console command.
*

View File

@@ -46,7 +46,6 @@ class CreateAccessTokens extends Command
*/
protected $signature = 'firefly-iii:create-access-tokens';
/**
* Execute the console command.
*

View File

@@ -44,7 +44,6 @@ class CreateLinkTypes extends Command
*/
protected $signature = 'firefly-iii:create-link-types';
/**
* Execute the console command.
*

View File

@@ -46,7 +46,6 @@ class DeleteEmptyGroups extends Command
*/
protected $signature = 'firefly-iii:delete-empty-groups';
/**
* Execute the console command.
*

View File

@@ -48,7 +48,6 @@ class DeleteEmptyJournals extends Command
*/
protected $signature = 'firefly-iii:delete-empty-journals';
/**
* Execute the console command.
*

View File

@@ -48,7 +48,6 @@ class DeleteOrphanedTransactions extends Command
*/
protected $signature = 'firefly-iii:delete-orphaned-transactions';
/**
* Execute the console command.
*

View File

@@ -47,7 +47,6 @@ class DeleteZeroAmount extends Command
*/
protected $signature = 'firefly-iii:delete-zero-amount';
/**
* Execute the console command.
*

View File

@@ -50,7 +50,6 @@ class EnableCurrencies extends Command
*/
protected $signature = 'firefly-iii:enable-currencies';
/**
* Execute the console command.
*

View File

@@ -47,7 +47,6 @@ class FixAccountOrder extends Command
private AccountRepositoryInterface $repository;
/**
* Execute the console command.
*

View File

@@ -53,7 +53,6 @@ class FixAccountTypes extends Command
private array $expected;
private AccountFactory $factory;
/**
* Execute the console command.
*

View File

@@ -49,7 +49,6 @@ class FixGroupAccounts extends Command
*/
protected $signature = 'firefly-iii:unify-group-accounts';
/**
* Execute the console command.
*
@@ -75,7 +74,6 @@ class FixGroupAccounts extends Command
$this->line('Updated inconsistent transaction groups.');
return 0;
}
}

View File

@@ -47,7 +47,6 @@ class FixLongDescriptions extends Command
*/
protected $signature = 'firefly-iii:fix-long-descriptions';
/**
* Execute the console command.
*

View File

@@ -51,7 +51,6 @@ class FixPiggies extends Command
/** @var int */
private $count;
/**
* Execute the console command.
*

View File

@@ -54,7 +54,6 @@ class FixRecurringTransactions extends Command
/** @var UserRepositoryInterface */
private $userRepos;
/**
* Execute the console command.
*
@@ -65,8 +64,6 @@ class FixRecurringTransactions extends Command
$start = microtime(true);
$this->stupidLaravel();
$this->correctTransactions();
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Corrected recurring transactions in %s seconds.', $end));

View File

@@ -50,7 +50,6 @@ class FixTransactionTypes extends Command
*/
protected $signature = 'firefly-iii:fix-transaction-types';
/**
* Execute the console command.
*

View File

@@ -48,7 +48,6 @@ class FixUnevenAmount extends Command
*/
protected $signature = 'firefly-iii:fix-uneven-amount';
/**
* Execute the console command.
*

View File

@@ -45,7 +45,6 @@ class RemoveBills extends Command
*/
protected $signature = 'firefly-iii:remove-bills';
/**
* Execute the console command.
*

View File

@@ -46,7 +46,6 @@ class RenameMetaFields extends Command
private int $count;
/**
* Execute the console command.
*

View File

@@ -46,7 +46,6 @@ class TransferBudgets extends Command
*/
protected $signature = 'firefly-iii:fix-transfer-budgets';
/**
* Execute the console command.
*

View File

@@ -28,7 +28,6 @@ use Illuminate\Console\Command;
use PDO;
use PDOException;
/**
* Class CreateDatabase
*/
@@ -47,7 +46,6 @@ class CreateDatabase extends Command
*/
protected $signature = 'firefly-iii:create-database';
/**
* Execute the console command.
*

View File

@@ -47,7 +47,7 @@ class CreateFirstUser extends Command
*
* @var string
*/
protected $signature = 'firefly-iii:create-first-user {email}';
protected $signature = 'firefly-iii:create-first-user {email}';
private UserRepositoryInterface $repository;
/**

View File

@@ -78,7 +78,6 @@ class ExportData extends Command
private JournalRepositoryInterface $journalRepository;
private User $user;
/**
* Execute the console command.
*
@@ -115,8 +114,6 @@ class ExportData extends Command
$exporter->setStart($options['start']);
$exporter->setEnd($options['end']);
$exporter->setAccounts($options['accounts']);
$exporter->setExportTransactions($options['export']['transactions']);
$exporter->setExportAccounts($options['export']['accounts']);
$exporter->setExportBudgets($options['export']['budgets']);
@@ -294,6 +291,4 @@ class ExportData extends Command
$this->info(sprintf('Wrote %s-export to file "%s".', $key, $file));
}
}
}

View File

@@ -48,7 +48,6 @@ class ReportEmptyObjects extends Command
*/
protected $signature = 'firefly-iii:report-empty-objects';
/**
* Execute the console command.
*

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Integrity;
use Artisan;
use Illuminate\Console\Command;
use Schema;
@@ -49,7 +48,6 @@ class ReportIntegrity extends Command
*/
protected $signature = 'firefly-iii:report-integrity';
/**
* Execute the console command.
*/

View File

@@ -45,7 +45,6 @@ class ReportSum extends Command
*/
protected $signature = 'firefly-iii:report-sum';
/**
* Execute the console command.
*
@@ -58,7 +57,6 @@ class ReportSum extends Command
return 0;
}
/**
* Reports for each user when the sum of their transactions is not zero.
*/

View File

@@ -46,7 +46,6 @@ class RestoreOAuthKeys extends Command
*/
protected $signature = 'firefly-iii:restore-oauth-keys';
/**
* Execute the console command.
*

View File

@@ -54,7 +54,6 @@ class ScanAttachments extends Command
*/
protected $signature = 'firefly-iii:scan-attachments';
/**
* Execute the console command.
*/

View File

@@ -44,7 +44,6 @@ class SetLatestVersion extends Command
*/
protected $signature = 'firefly-iii:set-latest-version {--james-is-cool}';
/**
* Execute the console command.
*

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Tools;
use Carbon\Carbon;
use FireflyIII\Console\Commands\VerifiesAccessToken;
use FireflyIII\Exceptions\FireflyException;
@@ -78,7 +77,6 @@ class ApplyRules extends Command
private array $ruleSelection;
private Carbon $startDate;
/**
* Execute the console command.
*
@@ -227,8 +225,6 @@ class ApplyRules extends Command
/** @var AccountRepositoryInterface $accountRepository */
$accountRepository = app(AccountRepositoryInterface::class);
$accountRepository->setUser($this->getUser());
foreach ($accountList as $accountId) {
$accountId = (int)$accountId;
$account = $accountRepository->findNull($accountId);

View File

@@ -57,7 +57,6 @@ class Cron extends Command
{--date= : Set the date in YYYY-MM-DD to make Firefly III think that\'s the current date.}
';
/**
* @return int
*/

View File

@@ -59,7 +59,6 @@ class AccountCurrencies extends Command
/** @var UserRepositoryInterface */
private $userRepos;
/**
* Each (asset) account must have a reference to a preferred currency. If the account does not have one, it's forced upon the account.
*
@@ -88,7 +87,6 @@ class AccountCurrencies extends Command
$this->info(sprintf('Verified and fixed account currencies in %s seconds.', $end));
$this->markAsExecuted();
return 0;
}
@@ -206,8 +204,6 @@ class AccountCurrencies extends Command
return;
}
// do not match and opening balance id is not null.
if ($accountCurrency !== $obCurrency && null !== $openingBalance) {
Log::debug(sprintf('Account (#%d) and OB currency (#%d) are different. Overrule OB, set to account currency.', $accountCurrency, $obCurrency));

View File

@@ -1,5 +1,4 @@
<?php
/*
* AppendBudgetLimitPeriods.php
* Copyright (c) 2021 james@firefly-iii.org
@@ -21,25 +20,6 @@
*/
declare(strict_types=1);
/*
* AppendBudgetLimitPeriods.php
* Copyright (c) 2020 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace FireflyIII\Console\Commands\Upgrade;

View File

@@ -51,7 +51,6 @@ class BackToJournals extends Command
*/
protected $signature = 'firefly-iii:back-to-journals {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
*

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Models\Budget;
use FireflyIII\Models\BudgetLimit;
use Illuminate\Console\Command;
@@ -47,7 +46,6 @@ class BudgetLimitCurrency extends Command
*/
protected $signature = 'firefly-iii:bl-currency {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
*
@@ -109,7 +107,6 @@ class BudgetLimitCurrency extends Command
return false; // @codeCoverageIgnore
}
/**
*
*/

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use Illuminate\Console\Command;
@@ -34,8 +33,6 @@ use Illuminate\Support\Collection;
*/
class CCLiabilities extends Command
{
public const CONFIG_NAME = '480_cc_liabilities';
/**
* The console command description.
@@ -50,7 +47,6 @@ class CCLiabilities extends Command
*/
protected $signature = 'firefly-iii:cc-liabilities {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
*
@@ -108,7 +104,6 @@ class CCLiabilities extends Command
return false; // @codeCoverageIgnore
}
/**
*
*/

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Models\Attachment;
use FireflyIII\Models\Note;
use Illuminate\Console\Command;
@@ -48,7 +47,6 @@ class MigrateAttachments extends Command
*/
protected $signature = 'firefly-iii:migrate-attachments {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
*
@@ -118,7 +116,6 @@ class MigrateAttachments extends Command
return false; // @codeCoverageIgnore
}
/**
*
*/

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use Exception;
use FireflyIII\Models\Note;
use FireflyIII\Models\TransactionJournalMeta;
@@ -49,7 +48,6 @@ class MigrateJournalNotes extends Command
*/
protected $signature = 'firefly-iii:migrate-notes {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
*
@@ -117,7 +115,6 @@ class MigrateJournalNotes extends Command
return false; // @codeCoverageIgnore
}
/**
*
*/

View File

@@ -47,7 +47,6 @@ class MigrateRecurrenceMeta extends Command
*/
protected $signature = 'firefly-iii:migrate-recurrence-meta {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
*

View File

@@ -1,5 +1,27 @@
<?php
/*
* MigrateRecurrenceType.php
* Copyright (c) 2021 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Models\Recurrence;

View File

@@ -48,7 +48,6 @@ class MigrateTagLocations extends Command
*/
protected $signature = 'firefly-iii:migrate-tag-locations {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
*
@@ -130,6 +129,4 @@ class MigrateTagLocations extends Command
{
app('fireflyconfig')->set(self::CONFIG_NAME, true);
}
}

View File

@@ -104,8 +104,6 @@ class MigrateToGroups extends Command
if (0 === $this->count) {
$this->line('No journals to migrate to groups.');
}
$this->markAsMigrated();
return 0;

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Preference;
@@ -63,7 +62,6 @@ class MigrateToRules extends Command
/** @var UserRepositoryInterface */
private $userRepository;
/**
* Execute the console command.
*

View File

@@ -66,7 +66,6 @@ class OtherCurrenciesCorrections extends Command
/** @var JournalRepositoryInterface */
private $journalRepos;
/**
* Execute the console command.
*

View File

@@ -45,7 +45,6 @@ class RenameAccountMeta extends Command
*/
protected $signature = 'firefly-iii:rename-account-meta {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
*
@@ -108,7 +107,6 @@ class RenameAccountMeta extends Command
return false; // @codeCoverageIgnore
}
/**
*
*/

View File

@@ -57,7 +57,6 @@ class TransactionIdentifier extends Command
/** @var JournalRepositoryInterface */
private $journalRepository;
/**
* This method gives all transactions which are part of a split journal (so more than 2) a sort of "order" so they are easier
* to easier to match to their counterpart. When a journal is split, it has two or three transactions: -3, -4 and -5 for example.

View File

@@ -70,8 +70,6 @@ class TransferCurrenciesCorrections extends Command
*/
public function handle(): int
{
$this->stupidLaravel();
$start = microtime(true);
// @codeCoverageIgnoreStart
@@ -188,8 +186,6 @@ class TransferCurrenciesCorrections extends Command
return;
}
// @codeCoverageIgnoreEnd
// both accounts must have currency preference:
// @codeCoverageIgnoreStart
if ($this->isNoCurrencyPresent()) {

View File

@@ -48,7 +48,6 @@ class UpgradeDatabase extends Command
*/
protected $signature = 'firefly-iii:upgrade-database {--F|force : Force all upgrades.}';
/**
* Execute the console command.
*
@@ -58,8 +57,6 @@ class UpgradeDatabase extends Command
{
$this->callInitialCommands();
$commands = [
// there are 14 upgrade commands.
'firefly-iii:transaction-identifiers',

View File

@@ -50,7 +50,6 @@ class UpgradeFireflyInstructions extends Command
*/
protected $signature = 'firefly:instructions {task}';
/**
* Execute the console command.
*/
@@ -168,8 +167,6 @@ class UpgradeFireflyInstructions extends Command
$text = $config[$compare];
}
}
$this->showLine();
$this->boxed('');
if (null === $text) {