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

@@ -66,8 +66,6 @@ class AccountDestroyService
// delete account meta:
$account->accountMeta()->delete();
// delete account.
try {
$account->delete();

View File

@@ -66,8 +66,6 @@ trait AccountServiceTrait
return null;
}
return $iban;
}

View File

@@ -61,8 +61,6 @@ trait BillServiceTrait
$ruleAction->save();
}
}
/**
* @param Bill $bill
* @param string $note

View File

@@ -41,8 +41,6 @@ use FireflyIII\Models\RecurrenceTransactionMeta;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Validation\AccountValidator;
use Log;
/**
* Trait RecurringTransactionTrait
*
@@ -136,8 +134,6 @@ trait RecurringTransactionTrait
$validator = app(AccountValidator::class);
$validator->setUser($recurrence->user);
$validator->setTransactionType($recurrence->transactionType->type);
if (!$validator->validateSource($source->id, null, null)) {
throw new FireflyException(sprintf('Source invalid: %s', $validator->sourceError)); // @codeCoverageIgnore
}

View File

@@ -76,8 +76,6 @@ class BillUpdateService
'amount_max' => $bill->amount_max,
'transaction_currency_name' => $bill->transactionCurrency->name,
];
// update note:
if (array_key_exists('notes', $data)) {
$this->updateNote($bill, (string)$data['notes']);

View File

@@ -39,8 +39,6 @@ use Log;
class CategoryUpdateService
{
private $user;
/**
* Constructor.
*/
@@ -138,8 +136,6 @@ class CategoryUpdateService
->where('rt_meta.value', $oldName)
->update(['rt_meta.value' => $newName]);
}
/**
* @param Category $category
* @param array $data

View File

@@ -51,8 +51,6 @@ class GroupCloneService
foreach ($group->transactionJournals as $journal) {
$this->cloneJournal($journal, $newGroup, (int)$group->id);
}
return $newGroup;
}
@@ -147,6 +145,4 @@ class GroupCloneService
$newMeta->save();
}
}
}

View File

@@ -145,8 +145,6 @@ class JournalUpdateService
$this->updateField('description');
$this->updateField('date');
$this->updateField('order');
$this->transactionJournal->save();
$this->transactionJournal->refresh();
@@ -294,8 +292,6 @@ class JournalUpdateService
$validator->setTransactionType($expectedType);
$validator->setUser($this->transactionJournal->user);
$validator->source = $this->getValidSourceAccount();
$result = $validator->validateDestination($destId, $destName, null);
Log::debug(sprintf('hasValidDestinationAccount(%d, "%s") will return %s', $destId, $destName, var_export($result, true)));
@@ -393,8 +389,6 @@ class JournalUpdateService
// refresh transactions.
$this->sourceTransaction->refresh();
$this->destinationTransaction->refresh();
Log::debug(sprintf('Will set source to #%d ("%s")', $source->id, $source->name));
Log::debug(sprintf('Will set dest to #%d ("%s")', $destination->id, $destination->name));
}
@@ -505,8 +499,6 @@ class JournalUpdateService
// do some parsing.
Log::debug(sprintf('Create date value from string "%s".', $value));
}
$this->transactionJournal->$fieldName = $value;
Log::debug(sprintf('Updated %s', $fieldName));
}
@@ -692,13 +684,9 @@ class JournalUpdateService
$origSourceTransaction = $this->getSourceTransaction();
$origSourceTransaction->amount = app('steam')->negative($amount);
$origSourceTransaction->save();
$destTransaction = $this->getDestinationTransaction();
$destTransaction->amount = app('steam')->positive($amount);
$destTransaction->save();
// refresh transactions.
$this->sourceTransaction->refresh();
$this->destinationTransaction->refresh();
@@ -738,8 +726,6 @@ class JournalUpdateService
$source->foreign_currency_id = $foreignCurrency->id;
$source->foreign_amount = app('steam')->negative($foreignAmount);
$source->save();
$dest->foreign_currency_id = $foreignCurrency->id;
$dest->foreign_amount = app('steam')->positive($foreignAmount);
$dest->save();

View File

@@ -103,8 +103,6 @@ class RecurrenceUpdateService
$this->updateRepetitions($recurrence, $data['repetitions'] ?? []);
}
// update all transactions:
// update all transactions (and associated meta-data)
if (array_key_exists('transactions', $data)) {
$this->updateTransactions($recurrence, $data['transactions'] ?? []);
@@ -240,8 +238,6 @@ class RecurrenceUpdateService
return;
}
$currencyFactory = app(TransactionCurrencyFactory::class);
// loop all and try to match them:
if ($originalCount === count($transactions)) {
Log::debug('Loop and find');

View File

@@ -1,5 +1,4 @@
<?php
/*
* StandardWebhookSender.php
* Copyright (c) 2021 james@firefly-iii.org
@@ -21,25 +20,6 @@
*/
declare(strict_types=1);
/*
* StandardWebhookSender.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\Services\Webhook;

View File

@@ -1,5 +1,4 @@
<?php
/*
* WebhookSenderInterface.php
* Copyright (c) 2021 james@firefly-iii.org
@@ -21,25 +20,6 @@
*/
declare(strict_types=1);
/*
* WebhookSenderInterface.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\Services\Webhook;