-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
some code reformatting / inlined a method
- Loading branch information
Showing
4 changed files
with
35 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
<?php | ||
|
||
namespace Kingsquare\Parser\Banking\Mt940\Engine; | ||
|
||
use Kingsquare\Parser\Banking\Mt940\Engine; | ||
|
||
/** | ||
* **CAUTION** This is an untested / experimental engine for SNS | ||
* | ||
* | ||
* @package Kingsquare\Parser\Banking\Mt940\Engine | ||
* @author Paul Olthof ([email protected]) | ||
* @license http://opensource.org/licenses/MIT MIT | ||
|
@@ -19,11 +23,18 @@ protected function parseStatementBank() | |
return 'SNS'; | ||
} | ||
|
||
/** | ||
* @override just return the unsanitized IBAN string | ||
* @inheritdoc | ||
*/ | ||
protected function sanitizeAccount($string) | ||
{ | ||
return $string; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function parseTransactionAccount() | ||
{ | ||
$results = []; | ||
|
@@ -36,6 +47,9 @@ protected function parseTransactionAccount() | |
return ''; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function parseTransactionAccountName() | ||
{ | ||
$results = []; | ||
|
@@ -48,26 +62,25 @@ protected function parseTransactionAccountName() | |
return ''; | ||
} | ||
|
||
/** | ||
* @override filter out the first two meta-data lines | ||
* @inheritdoc | ||
*/ | ||
protected function parseTransactionDescription() | ||
{ | ||
$results = []; | ||
if (preg_match_all('/[\n]:86:(.*?)(?=\n(:6(1|2))|$)/s', $this->getCurrentTransactionData(), $results) | ||
&& !empty($results[1]) | ||
) { | ||
$this->filterMetaDataFromDescription($results); | ||
// filter out meta data | ||
$lines = explode("\r\n", $results[1][0]); | ||
unset($lines[0], $lines[1]); | ||
$results[1][0] = implode("\r\n", $lines); | ||
|
||
return $this->sanitizeDescription(implode(PHP_EOL, $results[1])); | ||
} | ||
|
||
return ''; | ||
} | ||
|
||
private function filterMetaDataFromDescription(&$results) | ||
{ | ||
$lines = explode("\r\n", $results[1][0]); | ||
unset($lines[0]); | ||
unset($lines[1]); | ||
$results[1][0] = implode("\r\n", $lines); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters