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-09 19:03:39 +02:00
|
|
|
use Log;
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2015-12-29 22:48:55 +01:00
|
|
|
/**
|
|
|
|
* @param array $data
|
|
|
|
*/
|
|
|
|
public function setData($data)
|
|
|
|
{
|
|
|
|
$this->data = $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array $row
|
|
|
|
*/
|
|
|
|
public function setRow($row)
|
|
|
|
{
|
|
|
|
$this->row = $row;
|
|
|
|
}
|
|
|
|
|
2015-07-05 07:18:48 +02:00
|
|
|
/**
|
|
|
|
* Fixes Rabobank specific thing.
|
|
|
|
*/
|
|
|
|
protected function rabobankFixEmptyOpposing()
|
|
|
|
{
|
2015-07-10 20:25:17 +02:00
|
|
|
Log::debug('RaboSpecifix: Opposing account name is "******".');
|
2015-07-09 19:36:14 +02:00
|
|
|
if (is_string($this->data['opposing-account-name']) && strlen($this->data['opposing-account-name']) == 0) {
|
2015-07-10 20:25:17 +02:00
|
|
|
Log::debug('RaboSpecifix: opp-name is zero length, changed to: "******"');
|
2015-07-05 19:57:44 +02:00
|
|
|
$this->data['opposing-account-name'] = $this->row[10];
|
2015-07-09 19:36:14 +02:00
|
|
|
|
2015-07-10 20:25:17 +02:00
|
|
|
Log::debug('Description was: "******".');
|
2015-07-09 19:36:14 +02:00
|
|
|
$this->data['description'] = trim(str_replace($this->row[10], '', $this->data['description']));
|
2015-07-10 20:25:17 +02:00
|
|
|
Log::debug('Description is now: "******".');
|
2015-07-05 07:18:48 +02:00
|
|
|
}
|
2015-07-09 19:36:14 +02:00
|
|
|
|
2015-07-05 07:18:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-07-09 21:26:40 +02:00
|
|
|
}
|