Files
firefly-iii/app/Helpers/Csv/Specifix/RabobankDescription.php

58 lines
998 B
PHP
Raw Normal View History

2015-07-05 07:18:48 +02:00
<?php
2015-07-05 19:57:44 +02:00
namespace FireflyIII\Helpers\Csv\Specifix;
2015-07-05 07:18:48 +02:00
/**
2015-07-05 19:57:44 +02:00
* Class RabobankDescription
2015-07-05 07:18:48 +02:00
*
2015-07-05 19:57:44 +02:00
* @package FireflyIII\Helpers\Csv\Specifix
2015-07-05 07:18:48 +02:00
*/
2015-07-05 19:57:44 +02:00
class RabobankDescription
2015-07-05 07:18:48 +02:00
{
/** @var array */
protected $data;
/** @var array */
protected $row;
/**
2015-07-05 19:57:44 +02:00
* @return array
2015-07-05 07:18:48 +02:00
*/
public function fix()
{
$this->rabobankFixEmptyOpposing();
2015-07-05 19:57:44 +02:00
return $this->data;
2015-07-05 07:18:48 +02:00
}
/**
* Fixes Rabobank specific thing.
*/
protected function rabobankFixEmptyOpposing()
{
2015-07-05 19:57:44 +02:00
if (strlen($this->data['opposing-account-name']) == 0) {
$this->data['opposing-account-name'] = $this->row[10];
2015-07-05 07:18:48 +02:00
}
$this->data['description'] = trim(str_replace($this->row[10], '', $this->data['description']));
}
/**
* @param array $data
*/
public function setData($data)
{
$this->data = $data;
}
/**
* @param array $row
*/
public function setRow($row)
{
$this->row = $row;
}
}