mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-15 19:09:50 +00:00
Various code cleanup.
This commit is contained in:
@@ -31,6 +31,7 @@ use Steam;
|
||||
*
|
||||
* Class Entry
|
||||
* @SuppressWarnings(PHPMD.LongVariable)
|
||||
* @SuppressWarnings(PHPMD.TooManyFields)
|
||||
*
|
||||
* @package FireflyIII\Export\Entry
|
||||
*/
|
||||
@@ -84,40 +85,12 @@ final class Entry
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $object
|
||||
*
|
||||
* @return Entry
|
||||
*/
|
||||
public static function fromObject($object): Entry
|
||||
{
|
||||
$entry = new self;
|
||||
$entry->journal_id = $object->transaction_journal_id;
|
||||
$entry->description = Steam::decrypt(intval($object->journal_encrypted), $object->journal_description);
|
||||
$entry->amount = $object->amount;
|
||||
$entry->date = $object->date;
|
||||
$entry->transaction_type = $object->transaction_type;
|
||||
$entry->currency_code = $object->transaction_currency_code;
|
||||
$entry->asset_account_id = $object->account_id;
|
||||
$entry->asset_account_name = Steam::decrypt(intval($object->account_name_encrypted), $object->account_name);
|
||||
$entry->opposing_account_id = $object->opposing_account_id;
|
||||
$entry->opposing_account_name = Steam::decrypt(intval($object->opposing_account_encrypted), $object->opposing_account_name);
|
||||
$entry->category_id = $object->category_id ?? '';
|
||||
$entry->category_name = $object->category_name ?? '';
|
||||
$entry->budget_id = $object->budget_id ?? '';
|
||||
$entry->budget_name = $object->budget_name ?? '';
|
||||
|
||||
// update description when transaction description is different:
|
||||
if (!is_null($object->description) && $object->description !== $entry->description) {
|
||||
$entry->description = $entry->description . ' (' . $object->description . ')';
|
||||
}
|
||||
|
||||
return $entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a given transaction (as collected by the collector) into an export entry.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // complex but little choice.
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) // cannot be helped
|
||||
*
|
||||
* @param Transaction $transaction
|
||||
*
|
||||
* @return Entry
|
||||
|
||||
@@ -34,6 +34,8 @@ use ZipArchive;
|
||||
/**
|
||||
* Class ExpandedProcessor
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) // its doing a lot.
|
||||
*
|
||||
* @package FireflyIII\Export
|
||||
*/
|
||||
class ExpandedProcessor implements ProcessorInterface
|
||||
@@ -84,7 +86,10 @@ class ExpandedProcessor implements ProcessorInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Collects all transaction journals.
|
||||
*
|
||||
* @return bool
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*/
|
||||
public function collectJournals(): bool
|
||||
{
|
||||
@@ -102,6 +107,7 @@ class ExpandedProcessor implements ProcessorInterface
|
||||
$opposingIds = $transactions->pluck('opposing_account_id')->toArray();
|
||||
$notes = $this->getNotes($ids);
|
||||
$tags = $this->getTags($ids);
|
||||
/** @var array $ibans */
|
||||
$ibans = $this->getIbans($assetIds) + $this->getIbans($opposingIds);
|
||||
$currencies = $this->getAccountCurrencies($ibans);
|
||||
$transactions->each(
|
||||
|
||||
Reference in New Issue
Block a user