mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
37 lines
986 B
PHP
37 lines
986 B
PHP
<?php
|
|
/**
|
|
* CurrencyId.php
|
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
*
|
|
* This software may be modified and distributed under the terms
|
|
* of the MIT license. See the LICENSE file for details.
|
|
*/
|
|
|
|
declare(strict_types = 1);
|
|
namespace FireflyIII\Helpers\Csv\Converter;
|
|
|
|
use FireflyIII\Models\TransactionCurrency;
|
|
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
|
|
|
/**
|
|
* Class CurrencyId
|
|
*
|
|
* @package FireflyIII\Helpers\Csv\Converter
|
|
*/
|
|
class CurrencyId extends BasicConverter implements ConverterInterface
|
|
{
|
|
|
|
/**
|
|
* @return TransactionCurrency
|
|
*/
|
|
public function convert(): TransactionCurrency
|
|
{
|
|
/** @var CurrencyRepositoryInterface $repository */
|
|
$repository = app(CurrencyRepositoryInterface::class);
|
|
$value = isset($this->mapped[$this->index][$this->value]) ? $this->mapped[$this->index][$this->value] : $this->value;
|
|
$currency = $repository->find($value);
|
|
|
|
return $currency;
|
|
}
|
|
}
|