Code cleanup.

This commit is contained in:
James Cole
2016-08-12 15:10:03 +02:00
parent 955306d877
commit 5c4d010bde
94 changed files with 106 additions and 363 deletions

View File

@@ -55,7 +55,6 @@ class ImportEntry
*/
public function __construct()
{
$this->defaultImportAccount = new Account;
/** @var string $value */
foreach ($this->validFields as $value) {
$this->fields[$value] = null;
@@ -63,21 +62,6 @@ class ImportEntry
}
}
/**
* @return ImportResult
*/
public function import(): ImportResult
{
$validation = $this->validate();
if ($validation->valid()) {
return $this->doImport();
}
return $validation;
}
/**
* @param string $role
* @param int $certainty
@@ -91,14 +75,11 @@ class ImportEntry
default:
Log::error('Import entry cannot handle object.', ['role' => $role]);
throw new FireflyException('Import entry cannot handle object of type "' . $role . '".');
break;
case 'amount':
/*
* Easy enough.
*/
$this->setFloat('amount', $convertedValue, $certainty);
$this->applyMultiplier('amount'); // if present.
return;
@@ -147,7 +128,7 @@ class ImportEntry
case 'sepa-ct-id':
case 'sepa-db':
case 'sepa-ct-op':
case'description':
case 'description':
$this->setAppendableString('description', $convertedValue);
break;
case '_ignore':
@@ -160,6 +141,7 @@ class ImportEntry
case 'tags-comma':
case 'tags-space':
$this->appendCollection('tags', $convertedValue);
break;
case 'external-id':
$this->externalID = $convertedValue;
break;