mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-19 12:59:33 +00:00
Reformatted code according to scrutinizer-ci.
This commit is contained in:
@@ -17,7 +17,7 @@ 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);
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ 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;
|
||||||
@@ -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;
|
||||||
@@ -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;
|
||||||
@@ -138,11 +138,12 @@ 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;
|
||||||
}
|
}
|
||||||
@@ -152,16 +153,16 @@ class AbnAmroDescription
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user