Various code cleanup.

This commit is contained in:
James Cole
2017-12-22 18:32:43 +01:00
parent f13a93348f
commit 8bd76d1ff0
188 changed files with 383 additions and 396 deletions

View File

@@ -45,11 +45,11 @@ class ImportStorage
public $errors;
/** @var Collection */
public $journals;
/** @var BillRepositoryInterface */
/** @var BillRepositoryInterface */
protected $billRepository; // yes, hard coded
/** @var Collection */
protected $bills;
/** @var int */
/** @var int */
protected $defaultCurrencyId = 1;
/** @var ImportJob */
protected $job;
@@ -96,11 +96,11 @@ class ImportStorage
$config = $job->configuration;
$this->applyRules = $config['apply_rules'] ?? false;
$this->matchBills = $config['match_bills'] ?? false;
if ($this->applyRules === true) {
if (true === $this->applyRules) {
Log::debug('applyRules seems to be true, get the rules.');
$this->rules = $this->getRules();
}
if ($this->matchBills === true) {
if (true === $this->matchBills) {
Log::debug('matchBills seems to be true, get the bills');
$this->bills = $this->getBills();
$this->billRepository = app(BillRepositoryInterface::class);
@@ -226,22 +226,22 @@ class ImportStorage
$this->job->addStepsDone(1);
// run rules if config calls for it:
if ($this->applyRules === true) {
if (true === $this->applyRules) {
Log::info('Will apply rules to this journal.');
$this->applyRules($journal);
}
if (!($this->applyRules === true)) {
if (!(true === $this->applyRules)) {
Log::info('Will NOT apply rules to this journal.');
}
// match bills if config calls for it.
if ($this->matchBills === true) {
if (true === $this->matchBills) {
//$this->/applyRules($journal);
Log::info('Cannot match bills (yet).');
$this->matchBills($journal);
}
if (!($this->matchBills === true)) {
if (!(true === $this->matchBills)) {
Log::info('Cannot match bills (yet), but do not have to.');
}

View File

@@ -93,8 +93,9 @@ trait ImportSupport
*/
protected function matchBills(TransactionJournal $journal): bool
{
if(!is_null($journal->bill_id)) {
if (!is_null($journal->bill_id)) {
Log::debug('Journal is already linked to a bill, will not scan.');
return true;
}
if ($this->bills->count() > 0) {
@@ -264,6 +265,7 @@ trait ImportSupport
*
* @return string
*x
*
* @throws FireflyException
*
* @see ImportSupport::getOpposingAccount()
@@ -412,6 +414,7 @@ trait ImportSupport
* @param array $parameters
*
* @return TransactionJournal
*
* @throws FireflyException
*/
private function storeJournal(array $parameters): TransactionJournal