Various code cleanup.

This commit is contained in:
James Cole
2023-12-22 20:12:38 +01:00
parent 067d160c13
commit 581e5d7330
69 changed files with 361 additions and 317 deletions

View File

@@ -68,7 +68,7 @@ class AccountFactory
/**
* @throws FireflyException
* */
*/
public function findOrCreate(string $accountName, string $accountType): Account
{
app('log')->debug(sprintf('findOrCreate("%s", "%s")', $accountName, $accountType));
@@ -100,7 +100,7 @@ class AccountFactory
/**
* @throws FireflyException
* */
*/
public function create(array $data): Account
{
app('log')->debug('Now in AccountFactory::create()');
@@ -171,7 +171,7 @@ class AccountFactory
/**
* @throws FireflyException
* */
*/
private function createAccount(AccountType $type, array $data): Account
{
$this->accountRepository->resetAccountOrder();
@@ -239,7 +239,7 @@ class AccountFactory
/**
* @throws FireflyException
* */
*/
private function cleanMetaDataArray(Account $account, array $data): array
{
$currencyId = array_key_exists('currency_id', $data) ? (int)$data['currency_id'] : 0;

View File

@@ -43,7 +43,7 @@ class BillFactory
/**
* @throws FireflyException
* */
*/
public function create(array $data): ?Bill
{
app('log')->debug(sprintf('Now in %s', __METHOD__), $data);

View File

@@ -52,7 +52,9 @@ class RecurrenceFactory
/**
* @throws FireflyException
* */
*
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function create(array $data): Recurrence
{
try {
@@ -77,7 +79,7 @@ class RecurrenceFactory
$firstDate = $data['recurrence']['first_date'];
}
if (array_key_exists('nr_of_repetitions', $data['recurrence'])) {
$repetitions = (int)$data['recurrence']['nr_of_repetitions'];
$repetitions = (int) $data['recurrence']['nr_of_repetitions'];
}
if (array_key_exists('repeat_until', $data['recurrence'])) {
$repeatUntil = $data['recurrence']['repeat_until'];
@@ -114,7 +116,7 @@ class RecurrenceFactory
$recurrence->save();
if (array_key_exists('notes', $data['recurrence'])) {
$this->updateNote($recurrence, (string)$data['recurrence']['notes']);
$this->updateNote($recurrence, (string) $data['recurrence']['notes']);
}
$this->createRepetitions($recurrence, $data['repetitions'] ?? []);

View File

@@ -49,7 +49,7 @@ class TransactionGroupFactory
*
* @throws DuplicateTransactionException
* @throws FireflyException
* */
*/
public function create(array $data): TransactionGroup
{
app('log')->debug('Now in TransactionGroupFactory::create()');

View File

@@ -91,7 +91,7 @@ class TransactionJournalFactory
*
* @throws DuplicateTransactionException
* @throws FireflyException
* */
*/
public function create(array $data): Collection
{
app('log')->debug('Now in TransactionJournalFactory::create()');
@@ -344,7 +344,7 @@ class TransactionJournalFactory
* If this transaction already exists, throw an error.
*
* @throws DuplicateTransactionException
* */
*/
private function errorIfDuplicate(string $hash): void
{
app('log')->debug(sprintf('In errorIfDuplicate(%s)', $hash));
@@ -442,7 +442,7 @@ class TransactionJournalFactory
/**
* @throws FireflyException
* */
*/
private function getCurrencyByAccount(string $type, ?TransactionCurrency $currency, Account $source, Account $destination): TransactionCurrency
{
app('log')->debug('Now in getCurrencyByAccount()');
@@ -455,7 +455,7 @@ class TransactionJournalFactory
/**
* @throws FireflyException
* */
*/
private function getCurrency(?TransactionCurrency $currency, Account $account): TransactionCurrency
{
app('log')->debug('Now in getCurrency()');
@@ -489,7 +489,7 @@ class TransactionJournalFactory
/**
* @throws FireflyException
* */
*/
private function getForeignByAccount(string $type, ?TransactionCurrency $foreignCurrency, Account $destination): ?TransactionCurrency
{
if (TransactionType::TRANSFER === $type) {