Reformatted code according to scrutinizer-ci.

This commit is contained in:
James Cole 2016-01-19 09:11:15 +01:00
parent eed3d021d9
commit 26fb03e6c8
2 changed files with 47 additions and 46 deletions

View File

@ -17,7 +17,7 @@ class AmountComma extends BasicConverter implements ConverterInterface
*/
public function convert()
{
$value = str_replace(",", ".", $this->value );
$value = str_replace(',', '.', $this->value);
if (is_numeric($value)) {
return floatval($value);

View File

@ -32,7 +32,7 @@ class AbnAmroDescription
// If the description could not be parsed, specify an unknown opposing
// account, as an opposing account is required
if (!$parsed) {
$this->data[ "opposing-account-name" ] = trans('firefly.unknown');
$this->data['opposing-account-name'] = trans('firefly.unknown');
}
return $this->data;
@ -61,12 +61,11 @@ class AbnAmroDescription
protected function parseSepaDescription()
{
// 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.');
$type = trim($matches[1]);
// 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) {
$key = $match[1];
@ -100,7 +99,7 @@ class AbnAmroDescription
protected function parseTRTPDescription()
{
// 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.');
foreach ($matches as $match) {
@ -108,9 +107,10 @@ class AbnAmroDescription
$value = trim($match[2]);
switch (strtoupper($key)) {
case 'TRTP':
$type = $value;
break;
// is not being used.
// case 'TRTP':
// $type = $value;
// break;
case 'NAME':
$this->data['opposing-account-name'] = $value;
break;
@ -138,11 +138,12 @@ class AbnAmroDescription
protected function parseGEABEADescription()
{
// 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.');
$this->data[ "opposing-account-name" ] = $matches[4];
$this->data[ "description" ] = $matches[4];
// description and opposing account will be the same.
$this->data['opposing-account-name'] = $matches[4];
$this->data['description'] = $matches[4];
return true;
}
@ -152,16 +153,16 @@ class AbnAmroDescription
/**
* 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()
{
// 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.');
$this->data[ "opposing-account-name" ] = "ABN AMRO";
$this->data[ "description" ] = $matches[1];
$this->data['opposing-account-name'] = "ABN AMRO";
$this->data['description'] = $matches[1];
return true;
}