mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Reformatted code according to scrutinizer-ci.
This commit is contained in:
parent
eed3d021d9
commit
26fb03e6c8
@ -4,7 +4,7 @@ namespace FireflyIII\Helpers\Csv\Converter;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AmountComma
|
* Class AmountComma
|
||||||
*
|
*
|
||||||
* Parses the input as the amount with a comma as decimal separator
|
* Parses the input as the amount with a comma as decimal separator
|
||||||
*
|
*
|
||||||
* @package FireflyIII\Helpers\Csv\Converter
|
* @package FireflyIII\Helpers\Csv\Converter
|
||||||
@ -17,8 +17,8 @@ class AmountComma extends BasicConverter implements ConverterInterface
|
|||||||
*/
|
*/
|
||||||
public function convert()
|
public function convert()
|
||||||
{
|
{
|
||||||
$value = str_replace(",", ".", $this->value );
|
$value = str_replace(',', '.', $this->value);
|
||||||
|
|
||||||
if (is_numeric($value)) {
|
if (is_numeric($value)) {
|
||||||
return floatval($value);
|
return floatval($value);
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ namespace FireflyIII\Helpers\Csv\Specifix;
|
|||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the description from txt files for ABN AMRO bank accounts.
|
* Parses the description from txt files for ABN AMRO bank accounts.
|
||||||
*
|
*
|
||||||
* Based on the logic as described in the following Gist:
|
* Based on the logic as described in the following Gist:
|
||||||
* https://gist.github.com/vDorst/68d555a6a90f62fec004
|
* https://gist.github.com/vDorst/68d555a6a90f62fec004
|
||||||
*
|
*
|
||||||
@ -31,10 +31,10 @@ class AbnAmroDescription
|
|||||||
|
|
||||||
// If the description could not be parsed, specify an unknown opposing
|
// If the description could not be parsed, specify an unknown opposing
|
||||||
// account, as an opposing account is required
|
// account, as an opposing account is required
|
||||||
if( !$parsed ) {
|
if (!$parsed) {
|
||||||
$this->data[ "opposing-account-name" ] = trans('firefly.unknown');
|
$this->data['opposing-account-name'] = trans('firefly.unknown');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class AbnAmroDescription
|
|||||||
{
|
{
|
||||||
$this->row = $row;
|
$this->row = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the current description in SEPA format
|
* Parses the current description in SEPA format
|
||||||
* @return boolean true if the description is SEPA format, false otherwise
|
* @return boolean true if the description is SEPA format, false otherwise
|
||||||
@ -61,18 +61,17 @@ class AbnAmroDescription
|
|||||||
protected function parseSepaDescription()
|
protected function parseSepaDescription()
|
||||||
{
|
{
|
||||||
// See if the current description is formatted as a SEPA plain description
|
// See if the current description is formatted as a SEPA plain description
|
||||||
if( preg_match( "/^SEPA(.{28})/", $this->data[ "description" ], $matches ) ) {
|
if (preg_match('/^SEPA(.{28})/', $this->data['description'], $matches)) {
|
||||||
Log::debug('AbnAmroSpecifix: Description is structured as SEPA plain description.');
|
Log::debug('AbnAmroSpecifix: Description is structured as SEPA plain description.');
|
||||||
$type = trim($matches[1]);
|
|
||||||
|
|
||||||
// SEPA plain descriptions contain several key-value pairs, split by a colon
|
// SEPA plain descriptions contain several key-value pairs, split by a colon
|
||||||
preg_match_all( "/([A-Za-z]+(?=:\s)):\s([A-Za-z 0-9._#-]+(?=\s))/", $this->data[ "description" ], $matches, PREG_SET_ORDER );
|
preg_match_all('/([A-Za-z]+(?=:\s)):\s([A-Za-z 0-9._#-]+(?=\s))/', $this->data['description'], $matches, PREG_SET_ORDER);
|
||||||
|
|
||||||
foreach( $matches as $match ) {
|
foreach ($matches as $match) {
|
||||||
$key = $match[1];
|
$key = $match[1];
|
||||||
$value = trim($match[2]);
|
$value = trim($match[2]);
|
||||||
|
|
||||||
switch( strtoupper($key) ) {
|
switch (strtoupper($key)) {
|
||||||
case 'OMSCHRIJVING':
|
case 'OMSCHRIJVING':
|
||||||
$this->data['description'] = $value;
|
$this->data['description'] = $value;
|
||||||
break;
|
break;
|
||||||
@ -86,10 +85,10 @@ class AbnAmroDescription
|
|||||||
// Ignore the rest
|
// Ignore the rest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,17 +99,18 @@ class AbnAmroDescription
|
|||||||
protected function parseTRTPDescription()
|
protected function parseTRTPDescription()
|
||||||
{
|
{
|
||||||
// See if the current description is formatted in TRTP format
|
// See if the current description is formatted in TRTP format
|
||||||
if( preg_match_all( "!\/([A-Z]{3,4})\/([^/]*)!", $this->data[ "description" ], $matches, PREG_SET_ORDER ) ) {
|
if (preg_match_all('!\/([A-Z]{3,4})\/([^/]*)!', $this->data['description'], $matches, PREG_SET_ORDER)) {
|
||||||
Log::debug('AbnAmroSpecifix: Description is structured as TRTP format.');
|
Log::debug('AbnAmroSpecifix: Description is structured as TRTP format.');
|
||||||
|
|
||||||
foreach( $matches as $match ) {
|
foreach ($matches as $match) {
|
||||||
$key = $match[1];
|
$key = $match[1];
|
||||||
$value = trim($match[2]);
|
$value = trim($match[2]);
|
||||||
|
|
||||||
switch( strtoupper($key) ) {
|
switch (strtoupper($key)) {
|
||||||
case 'TRTP':
|
// is not being used.
|
||||||
$type = $value;
|
// case 'TRTP':
|
||||||
break;
|
// $type = $value;
|
||||||
|
// break;
|
||||||
case 'NAME':
|
case 'NAME':
|
||||||
$this->data['opposing-account-name'] = $value;
|
$this->data['opposing-account-name'] = $value;
|
||||||
break;
|
break;
|
||||||
@ -124,10 +124,10 @@ class AbnAmroDescription
|
|||||||
// Ignore the rest
|
// Ignore the rest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,35 +138,36 @@ class AbnAmroDescription
|
|||||||
protected function parseGEABEADescription()
|
protected function parseGEABEADescription()
|
||||||
{
|
{
|
||||||
// See if the current description is formatted in GEA/BEA format
|
// See if the current description is formatted in GEA/BEA format
|
||||||
if( preg_match( "/([BG]EA) +(NR:[a-zA-Z:0-9]+) +([0-9.\/]+) +([^,]*)/", $this->data[ "description" ], $matches ) ) {
|
if (preg_match('/([BG]EA) +(NR:[a-zA-Z:0-9]+) +([0-9.\/]+) +([^,]*)/', $this->data['description'], $matches)) {
|
||||||
Log::debug('AbnAmroSpecifix: Description is structured as GEA or BEA format.');
|
Log::debug('AbnAmroSpecifix: Description is structured as GEA or BEA format.');
|
||||||
|
|
||||||
$this->data[ "opposing-account-name" ] = $matches[4];
|
// description and opposing account will be the same.
|
||||||
$this->data[ "description" ] = $matches[4];
|
$this->data['opposing-account-name'] = $matches[4];
|
||||||
|
$this->data['description'] = $matches[4];
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the current description with costs from ABN AMRO itself
|
* Parses the current description with costs from ABN AMRO itself
|
||||||
* @return boolean true if the description is GEA/BEAformat, false otherwise
|
* @return boolean true if the description is GEA/BEA-format, false otherwise
|
||||||
*/
|
*/
|
||||||
protected function parseABNAMRODescription()
|
protected function parseABNAMRODescription()
|
||||||
{
|
{
|
||||||
// See if the current description is formatted in ABN AMRO format
|
// See if the current description is formatted in ABN AMRO format
|
||||||
if( preg_match( "/ABN AMRO.{24} (.*)/", $this->data[ "description" ], $matches ) ) {
|
if (preg_match('/ABN AMRO.{24} (.*)/', $this->data['description'], $matches)) {
|
||||||
Log::debug('AbnAmroSpecifix: Description is structured as costs from ABN AMRO itself.');
|
Log::debug('AbnAmroSpecifix: Description is structured as costs from ABN AMRO itself.');
|
||||||
|
|
||||||
$this->data[ "opposing-account-name" ] = "ABN AMRO";
|
$this->data['opposing-account-name'] = "ABN AMRO";
|
||||||
$this->data[ "description" ] = $matches[1];
|
$this->data['description'] = $matches[1];
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user