Code cleanup that (hopefully) matches style CI

This commit is contained in:
James Cole
2020-03-17 15:03:08 +01:00
parent 24129ab69c
commit 91c067ac9f
48 changed files with 182 additions and 131 deletions

View File

@@ -24,6 +24,7 @@ namespace FireflyIII\Import\Specifics;
/**
* Class IngDescription.
*
* @deprecated
* @codeCoverageIgnore
*
@@ -106,11 +107,14 @@ class IngDescription implements SpecificInterface
}
/**
* Remove "Omschrijving" (and NOT its value) from the description.
* Move "Valutadatum" from the description to new column.
*/
protected function removeIngDescription(): void
protected function moveValutadatumDescription(): void
{
$this->row[8] = preg_replace('/Omschrijving: /', '', $this->row[8]);
$matches = [];
preg_match('/Valutadatum: ([0-9-]+)/', $this->row[8], $matches);
$this->row[9] = date("Ymd", strtotime($matches[1]));
$this->row[8] = preg_replace('/Valutadatum: [0-9-]+/', '', $this->row[8]);
}
/**
@@ -123,6 +127,14 @@ class IngDescription implements SpecificInterface
$this->row[8] = preg_replace('/\sIBAN:\s' . $this->row[3] . '/', '', $this->row[8]);
}
/**
* Remove "Omschrijving" (and NOT its value) from the description.
*/
protected function removeIngDescription(): void
{
$this->row[8] = preg_replace('/Omschrijving: /', '', $this->row[8]);
}
/**
* Remove "Naam" (and its value) from the description.
*/
@@ -131,31 +143,20 @@ class IngDescription implements SpecificInterface
$this->row[8] = preg_replace('/Naam:.*?([a-zA-Z\/]+:)/', '$1', $this->row[8]);
}
/**
* Move "Valutadatum" from the description to new column.
*/
protected function moveValutadatumDescription(): void
{
$matches = array();
preg_match('/Valutadatum: ([0-9-]+)/', $this->row[8], $matches);
$this->row[9] = date("Ymd", strtotime($matches[1]));
$this->row[8] = preg_replace('/Valutadatum: [0-9-]+/', '', $this->row[8]);
}
/**
* Move savings account number to column 1 and name to column 3.
*/
private function MoveSavingsAccount(): void
{
$matches = array();
if ('' === (string)$this->row[3]) {
$matches = [];
if ('' === (string) $this->row[3]) {
if (preg_match('/(Naar|Van) (.*rekening) ([0-9]+)/', $this->row[8], $matches)) {
$matches[3] = sprintf("%010d", $matches[3]);
$matches[3] = sprintf("%010d", $matches[3]);
$this->row[1] = $matches[2]; // Savings account name
$this->row[3] = $matches[3]; // Savings account number
$this->row[8] = preg_replace('/(Naar|Van) (.*rekening) ([0-9]+)/', '', $this->row[8]); // Remove the savings account content from description
} elseif (preg_match('/(Naar|Van) (.*rekening) ([0-9]+)/', $this->row[1], $matches)) {
$matches[3] = sprintf("%010d", $matches[3]);
$matches[3] = sprintf("%010d", $matches[3]);
$this->row[1] = $matches[2]; // Savings account name
$this->row[3] = $matches[3]; // Savings account number
}