From 8e6030b8d21edaa99f83ae1124335cd84c2ec8d7 Mon Sep 17 00:00:00 2001 From: Robin Speekenbrink Date: Mon, 18 Mar 2019 15:45:42 +0100 Subject: [PATCH] removed default param usage --- src/Parser/Banking/Mt940/Engine.php | 11 +++++------ src/Parser/Banking/Mt940/Engine/Abn.php | 2 +- src/Parser/Banking/Mt940/Engine/Hsbc.php | 4 ++-- src/Parser/Banking/Mt940/Engine/Rabo.php | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Parser/Banking/Mt940/Engine.php b/src/Parser/Banking/Mt940/Engine.php index 2b44e83..65975e1 100644 --- a/src/Parser/Banking/Mt940/Engine.php +++ b/src/Parser/Banking/Mt940/Engine.php @@ -104,7 +104,7 @@ private static function detectBank($string) } } - trigger_error('Unknown mt940 parser loaded, thus reverted to default', E_USER_NOTICE); + trigger_error('Unknown mt940 parser loaded, thus reverted to default'); return new Engine\Unknown(); } @@ -357,7 +357,7 @@ protected function parseTimestampFromStatement($key) if (preg_match('/:' . $key . ':[C|D](\d{6})*/', $this->getCurrentStatementData(), $results) && !empty($results[1]) ) { - return $this->sanitizeTimestamp($results[1], 'ymd'); + return $this->sanitizeTimestamp($results[1]); } return 0; @@ -390,7 +390,7 @@ protected function parseStatementNumber() protected function parseTransactionAccount() { $results = []; - if (preg_match('/^:86: ?([\d\.]+)\s/im', $this->getCurrentTransactionData(), $results) + if (preg_match('/^:86: ?([\d\.]+)\s/m', $this->getCurrentTransactionData(), $results) && !empty($results[1]) ) { return $this->sanitizeAccount($results[1]); @@ -509,7 +509,7 @@ protected function parseTransactionTimestamp($key) if (preg_match('/^:' . $key . ':(\d{6})/', $this->getCurrentTransactionData(), $results) && !empty($results[1]) ) { - return $this->sanitizeTimestamp($results[1], 'ymd'); + return $this->sanitizeTimestamp($results[1]); } return 0; @@ -528,7 +528,6 @@ protected function parseTransactionCode() ) { return trim($results[1]); } - return ''; } @@ -587,7 +586,7 @@ protected function sanitizeAccountName($string) protected function sanitizeTimestamp($string, $inFormat = 'ymd') { $date = \DateTime::createFromFormat($inFormat, $string); - $date->setTime(0, 0, 0); + $date->setTime(0, 0); if ($date !== false) { return (int)$date->format('U'); } diff --git a/src/Parser/Banking/Mt940/Engine/Abn.php b/src/Parser/Banking/Mt940/Engine/Abn.php index 47703f5..f2acd23 100644 --- a/src/Parser/Banking/Mt940/Engine/Abn.php +++ b/src/Parser/Banking/Mt940/Engine/Abn.php @@ -95,7 +95,7 @@ protected function parseTransactionEntryTimestamp() $entryDate = ($valueDateY + 1) . $entryDateMD; } - return $this->sanitizeTimestamp($entryDate, 'ymd'); + return $this->sanitizeTimestamp($entryDate); } return 0; diff --git a/src/Parser/Banking/Mt940/Engine/Hsbc.php b/src/Parser/Banking/Mt940/Engine/Hsbc.php index 58d0d65..e532770 100644 --- a/src/Parser/Banking/Mt940/Engine/Hsbc.php +++ b/src/Parser/Banking/Mt940/Engine/Hsbc.php @@ -179,7 +179,7 @@ protected function parseTransactionEntryTimestamp() { $results = []; if (preg_match('/^:60F:[C|D]([\d]{6})/m', $this->getCurrentStatementData(), $results)) { - return $this->sanitizeTimestamp($results[1], 'ymd'); + return $this->sanitizeTimestamp($results[1]); } return 0; @@ -194,7 +194,7 @@ protected function parseTransactionValueTimestamp() { $results = []; if (preg_match(self::PATTERN_TAG_61, $this->getCurrentTransactionData(), $results)) { - return $this->sanitizeTimestamp($results[1], 'ymd'); + return $this->sanitizeTimestamp($results[1]); } return 0; diff --git a/src/Parser/Banking/Mt940/Engine/Rabo.php b/src/Parser/Banking/Mt940/Engine/Rabo.php index 099d46b..1686714 100644 --- a/src/Parser/Banking/Mt940/Engine/Rabo.php +++ b/src/Parser/Banking/Mt940/Engine/Rabo.php @@ -85,7 +85,7 @@ protected function parseTransactionEntryTimestamp() { $results = []; if (preg_match('/^:60F:[C|D]([\d]{6})/m', $this->getCurrentStatementData(), $results) && !empty($results[1])) { - return $this->sanitizeTimestamp($results[1], 'ymd'); + return $this->sanitizeTimestamp($results[1]); } return 0; @@ -100,7 +100,7 @@ protected function parseTransactionValueTimestamp() { $results = []; if (preg_match('/^:61:([\d]{6})[C|D]/', $this->getCurrentTransactionData(), $results) && !empty($results[1])) { - return $this->sanitizeTimestamp($results[1], 'ymd'); + return $this->sanitizeTimestamp($results[1]); } return 0;