Files
firefly-iii/app/Helpers/Csv/PostProcessing/Currency.php

42 lines
828 B
PHP
Raw Normal View History

2015-07-05 19:31:58 +02:00
<?php
namespace FireflyIII\Helpers\Csv\PostProcessing;
2015-07-06 16:52:18 +02:00
2015-07-05 19:31:58 +02:00
use FireflyIII\Models\TransactionCurrency;
2015-07-06 16:52:18 +02:00
use Preferences;
2015-07-05 19:31:58 +02:00
/**
* Class Currency
*
* @package FireflyIII\Helpers\Csv\PostProcessing
*/
class Currency implements PostProcessorInterface
{
/** @var array */
protected $data;
/**
* @return array
*/
public function process()
{
// fix currency
if (is_null($this->data['currency'])) {
$currencyPreference = Preferences::get('currencyPreference', env('DEFAULT_CURRENCY', 'EUR'));
2015-07-06 16:52:18 +02:00
$this->data['currency'] = TransactionCurrency::whereCode($currencyPreference->data)->first();
2015-07-05 19:31:58 +02:00
}
return $this->data;
}
/**
* @param array $data
*/
public function setData(array $data)
{
$this->data = $data;
}
2015-07-09 21:26:40 +02:00
}