2015-07-05 06:18:02 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace FireflyIII\Helpers\Csv\Converter;
|
2015-07-06 16:52:18 +02:00
|
|
|
|
2015-07-05 06:18:02 +02:00
|
|
|
use FireflyIII\Models\TransactionCurrency;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class CurrencyCode
|
|
|
|
*
|
|
|
|
* @package FireflyIII\Helpers\Csv\Converter
|
|
|
|
*/
|
|
|
|
class CurrencyCode extends BasicConverter implements ConverterInterface
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return mixed|static
|
|
|
|
*/
|
|
|
|
public function convert()
|
|
|
|
{
|
|
|
|
if (isset($this->mapped[$this->index][$this->value])) {
|
|
|
|
$currency = TransactionCurrency::find($this->mapped[$this->index][$this->value]);
|
|
|
|
} else {
|
|
|
|
$currency = TransactionCurrency::whereCode($this->value)->first();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $currency;
|
|
|
|
}
|
2015-07-09 21:26:40 +02:00
|
|
|
}
|