Files
firefly-iii/app/Helpers/Csv/Converter/CurrencyId.php

29 lines
811 B
PHP
Raw Normal View History

2015-07-05 15:16:44 +02:00
<?php
2016-02-05 12:08:25 +01:00
declare(strict_types = 1);
2015-07-05 15:16:44 +02:00
namespace FireflyIII\Helpers\Csv\Converter;
use FireflyIII\Models\TransactionCurrency;
2016-04-01 14:10:08 +02:00
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
2015-07-05 15:16:44 +02:00
/**
* Class CurrencyId
*
* @package FireflyIII\Helpers\Csv\Converter
*/
class CurrencyId extends BasicConverter implements ConverterInterface
{
/**
2016-01-19 08:48:38 +01:00
* @return TransactionCurrency
2015-07-05 15:16:44 +02:00
*/
2016-04-06 16:37:28 +02:00
public function convert(): TransactionCurrency
2015-07-05 15:16:44 +02:00
{
2016-04-01 14:10:08 +02:00
/** @var CurrencyRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
2016-04-27 06:43:17 +02:00
$value = isset($this->mapped[$this->index][$this->value]) ? $this->mapped[$this->index][$this->value] : $this->value;
$currency = $repository->find($value);
2015-07-05 15:16:44 +02:00
return $currency;
}
2015-07-09 21:26:40 +02:00
}