mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-24 04:41:01 +00:00
44 lines
1.0 KiB
PHP
44 lines
1.0 KiB
PHP
<?php
|
|
/**
|
|
* CurrencySymbol.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 CurrencySymbol
|
|
*
|
|
* @package FireflyIII\Helpers\Csv\Converter
|
|
*/
|
|
class CurrencySymbol extends BasicConverter implements ConverterInterface
|
|
{
|
|
|
|
/**
|
|
* @return TransactionCurrency
|
|
*/
|
|
public function convert(): TransactionCurrency
|
|
{
|
|
/** @var CurrencyRepositoryInterface $repository */
|
|
$repository = app(CurrencyRepositoryInterface::class);
|
|
|
|
if (isset($this->mapped[$this->index][$this->value])) {
|
|
$currency = $repository->find($this->mapped[$this->index][$this->value]);
|
|
|
|
return $currency;
|
|
}
|
|
|
|
$currency = $repository->findBySymbol($this->value);
|
|
|
|
|
|
return $currency;
|
|
}
|
|
}
|