Various code cleanup.

This commit is contained in:
James Cole
2021-05-24 08:50:17 +02:00
parent 3ec9753808
commit 815fd5ff6b
135 changed files with 643 additions and 582 deletions

View File

@@ -146,6 +146,7 @@ class TransactionJournalFactory
* @return TransactionJournal|null
* @throws DuplicateTransactionException
* @throws FireflyException
* @throws \JsonException
*/
private function createJournal(NullArrayObject $row): ?TransactionJournal
{
@@ -294,16 +295,17 @@ class TransactionJournalFactory
* @param NullArrayObject $row
*
* @return string
* @throws \JsonException
*/
private function hashArray(NullArrayObject $row): string
{
$dataRow = $row->getArrayCopy();
unset($dataRow['import_hash_v2'], $dataRow['original_source']);
$json = json_encode($dataRow, JSON_THROW_ON_ERROR, 512);
$json = json_encode($dataRow, JSON_THROW_ON_ERROR);
if (false === $json) {
$json = json_encode((string)microtime(), JSON_THROW_ON_ERROR, 512);
$json = json_encode((string)microtime(), JSON_THROW_ON_ERROR);
Log::error(sprintf('Could not hash the original row! %s', json_last_error_msg()), $dataRow);
}
@@ -319,6 +321,7 @@ class TransactionJournalFactory
* @param string $hash
*
* @throws DuplicateTransactionException
* @throws \JsonException
*/
private function errorIfDuplicate(string $hash): void
{
@@ -417,7 +420,7 @@ class TransactionJournalFactory
/**
* Set foreign currency to NULL if it's the same as the normal currency:
*
* @param TransactionCurrency $currency
* @param TransactionCurrency|null $currency
* @param TransactionCurrency|null $foreignCurrency
*
* @return TransactionCurrency|null