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

42 lines
803 B
PHP
Raw Normal View History

2015-07-05 12:31:58 -05:00
<?php
namespace FireflyIII\Helpers\Csv\PostProcessing;
2015-07-06 09:52:18 -05:00
2015-07-05 12:31:58 -05:00
use FireflyIII\Models\TransactionCurrency;
2015-07-06 09:52:18 -05:00
use Preferences;
2015-07-05 12:31:58 -05: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'])) {
2015-07-06 09:52:18 -05:00
$currencyPreference = Preferences::get('currencyPreference', 'EUR');
$this->data['currency'] = TransactionCurrency::whereCode($currencyPreference->data)->first();
2015-07-05 12:31:58 -05:00
}
return $this->data;
}
/**
* @param array $data
*/
public function setData(array $data)
{
$this->data = $data;
}
2015-07-09 14:26:40 -05:00
}