Each CSV converter can set the certainty of their conversion.

This commit is contained in:
James Cole
2016-07-29 21:40:58 +02:00
parent 7707c81b2d
commit 3682467ae3
24 changed files with 1009 additions and 28 deletions

View File

@@ -34,6 +34,7 @@ class CurrencyName extends BasicConverter implements ConverterInterface
Log::debug('Going to convert using CurrencyName', ['value' => $value]);
if ($value === 0) {
$this->setCertainty(0);
return new TransactionCurrency;
}
@@ -45,7 +46,7 @@ class CurrencyName extends BasicConverter implements ConverterInterface
$currency = $repository->find(intval($this->mapping[$value]));
if (!is_null($currency->id)) {
Log::debug('Found currency by ID', ['id' => $currency->id]);
$this->setCertainty(100);
return $currency;
}
}
@@ -54,7 +55,7 @@ class CurrencyName extends BasicConverter implements ConverterInterface
$currency = $repository->findByName($value);
if (!is_null($currency->id)) {
Log::debug('Found currency by name ', ['id' => $currency->id]);
$this->setCertainty(100);
return $currency;
}
@@ -66,6 +67,7 @@ class CurrencyName extends BasicConverter implements ConverterInterface
'symbol' => strtoupper(substr($value, 0, 1)),
]
);
$this->setCertainty(100);
return $currency;