Lots of new code for importer and some preferences.

This commit is contained in:
James Cole
2016-07-24 18:47:55 +02:00
parent 87c0f1d86e
commit 1392275b81
41 changed files with 1562 additions and 369 deletions

View File

@@ -12,7 +12,7 @@ declare(strict_types = 1);
namespace FireflyIII\Import;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use Log;
/**
* Class ImportEntry
@@ -21,21 +21,39 @@ use FireflyIII\Models\Account;
*/
class ImportEntry
{
/** @var Account */
public $assetAccount;
public $amount;
/**
* @param $role
* @param $value
* @param string $role
* @param string $value
* @param int $certainty
* @param $convertedValue
*
* @throws FireflyException
*/
public function fromRawValue($role, $value)
public function importValue(string $role, string $value, int $certainty, $convertedValue)
{
switch ($role) {
default:
throw new FireflyException('Cannot handle role of type "' . $role . '".');
Log::error('Import entry cannot handle object.', ['role' => $role]);
throw new FireflyException('Import entry cannot handle object of type "' . $role . '".');
break;
case 'amount':
$this->setAmount($convertedValue);
return;
case 'account-id':
break;
}
}
/**
* @param float $amount
*/
private function setAmount(float $amount)
{
$this->amount = $amount;
}
}