diff --git a/.travis.yml b/.travis.yml index dc0a1c7..8879dca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,6 @@ cache: - $HOME/.composer/cache php: - - 5.4 - 5.5 - 5.6 - 7 diff --git a/composer.json b/composer.json index c8650f1..c0b9826 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ { "name": "Robin Speekenbrink", "email": "robin@kingsquare.nl" } ], "require": { - "php": ">=5.4" + "php": ">=5.5" }, "require-dev": { "phpunit/phpunit": "4.4.*", diff --git a/src/Banking/Statement.php b/src/Banking/Statement.php index 0603f6c..1da83f8 100644 --- a/src/Banking/Statement.php +++ b/src/Banking/Statement.php @@ -12,7 +12,7 @@ class Statement implements \JsonSerializable { private $bank = ''; private $account = ''; - private $transactions = array(); + private $transactions = []; private $startPrice = 0.0; private $endPrice = 0.0; private $timestamp = 0; diff --git a/src/Parser/Banking.php b/src/Parser/Banking.php index 30b9568..2893fe5 100644 --- a/src/Parser/Banking.php +++ b/src/Parser/Banking.php @@ -18,6 +18,6 @@ class Banking */ public function parse($string) { - return array(); + return []; } } diff --git a/src/Parser/Banking/Mt940.php b/src/Parser/Banking/Mt940.php index 7cd21b1..af3d90f 100644 --- a/src/Parser/Banking/Mt940.php +++ b/src/Parser/Banking/Mt940.php @@ -20,20 +20,27 @@ class Mt940 extends Banking * Parse the given string into an array of Banking\Statement objects * * @param string $string + * @param Banking\Mt940\Engine $engine * * @return \Kingsquare\Banking\Statement[] */ - public function parse($string) + public function parse($string, Banking\Mt940\Engine $engine = null) { if (!empty($string)) { // load engine - $this->engine = Banking\Mt940\Engine::__getInstance($string); + if ($engine === null) { + $engine = Banking\Mt940\Engine::__getInstance($string); + } + + $this->engine = $engine; + if ($this->engine instanceof Banking\Mt940\Engine) { // parse using the engine + $this->engine->loadString($string); return $this->engine->parse(); } } - return array(); + return []; } } diff --git a/src/Parser/Banking/Mt940/Engine.php b/src/Parser/Banking/Mt940/Engine.php index 8ae85a1..ffd10c1 100644 --- a/src/Parser/Banking/Mt940/Engine.php +++ b/src/Parser/Banking/Mt940/Engine.php @@ -89,7 +89,7 @@ public function loadString($string) */ public function parse() { - $results = array(); + $results = []; foreach ($this->parseStatementData() as $this->currentStatementData) { $statement = new Statement(); if ($this->debug) { @@ -145,10 +145,10 @@ protected function parseStatementData() */ protected function parseTransactionData() { - $results = array(); + $results = []; preg_match_all('/^:61:(.*?)(?=^:61:|^-X{,3}$|\Z)/sm', $this->getCurrentStatementData(), $results); - return ((!empty($results[0])) ? $results[0] : array()); + return ((!empty($results[0])) ? $results[0] : []); } /** @@ -195,7 +195,7 @@ protected function parseStatementBank() */ protected function parseStatementAccount() { - $results = array(); + $results = []; if (preg_match('/:25:([\d\.]+)*/', $this->getCurrentStatementData(), $results) && !empty($results[1]) ) { @@ -218,7 +218,7 @@ protected function parseStatementAccount() */ protected function parseStatementStartPrice() { - $results = array(); + $results = []; if (preg_match('/:60F:.*EUR([\d,\.]+)*/', $this->getCurrentStatementData(), $results) && !empty($results[1]) ) { @@ -234,7 +234,7 @@ protected function parseStatementStartPrice() */ protected function parseStatementEndPrice() { - $results = array(); + $results = []; if (preg_match('/:62F:.*EUR([\d,\.]+)*/', $this->getCurrentStatementData(), $results) && !empty($results[1]) ) { @@ -250,7 +250,7 @@ protected function parseStatementEndPrice() */ protected function parseStatementTimestamp() { - $results = array(); + $results = []; if (preg_match('/:60F:[C|D](\d{6})*/', $this->getCurrentStatementData(), $results) && !empty($results[1]) ) { @@ -266,7 +266,7 @@ protected function parseStatementTimestamp() */ protected function parseStatementNumber() { - $results = array(); + $results = []; if (preg_match('/:28C?:(.*)/', $this->getCurrentStatementData(), $results) && !empty($results[1]) ) { @@ -283,7 +283,7 @@ protected function parseStatementNumber() */ protected function parseTransactionAccount() { - $results = array(); + $results = []; if (preg_match('/^:86: ?([\d\.]+)\s/im', $this->getCurrentTransactionData(), $results) && !empty($results[1]) ) { @@ -299,7 +299,7 @@ protected function parseTransactionAccount() */ protected function parseTransactionAccountName() { - $results = array(); + $results = []; if (preg_match('/:86: ?[\d\.]+ (.+)/', $this->getCurrentTransactionData(), $results) && !empty($results[1]) ) { @@ -315,7 +315,7 @@ protected function parseTransactionAccountName() */ protected function parseTransactionPrice() { - $results = array(); + $results = []; if (preg_match('/^:61:.*[CD]([\d,\.]+)N/i', $this->getCurrentTransactionData(), $results) && !empty($results[1]) ) { @@ -331,7 +331,7 @@ protected function parseTransactionPrice() */ protected function parseTransactionDebitCredit() { - $results = array(); + $results = []; if (preg_match('/^:61:\d+([CD])\d+/', $this->getCurrentTransactionData(), $results) && !empty($results[1]) ) { @@ -347,7 +347,7 @@ protected function parseTransactionDebitCredit() */ protected function parseTransactionDescription() { - $results = array(); + $results = []; if (preg_match_all('/[\n]:86:(.*?)(?=\n(:6(1|2))|$)/s', $this->getCurrentTransactionData(), $results) && !empty($results[1]) ) { @@ -363,7 +363,7 @@ protected function parseTransactionDescription() */ protected function parseTransactionEntryTimestamp() { - $results = array(); + $results = []; if (preg_match('/^:61:(\d{6})/', $this->getCurrentTransactionData(), $results) && !empty($results[1]) ) { @@ -379,7 +379,7 @@ protected function parseTransactionEntryTimestamp() */ protected function parseTransactionValueTimestamp() { - $results = array(); + $results = []; if (preg_match('/^:61:(\d{6})/', $this->getCurrentTransactionData(), $results) && !empty($results[1]) ) { @@ -395,7 +395,7 @@ protected function parseTransactionValueTimestamp() */ protected function parseTransactionCode() { - $results = array(); + $results = []; if (preg_match('/^:61:.*?N(.{3}).*/', $this->getCurrentTransactionData(), $results) && !empty($results[1]) ) { @@ -412,11 +412,11 @@ protected function parseTransactionCode() */ protected function sanitizeAccount($string) { - static $crudeReplacements = array( + static $crudeReplacements = [ '.' => '', ' ' => '', 'GIRO' => 'P', - ); + ]; // crude IBAN to 'old' converter if (Mt940::$removeIBAN diff --git a/src/Parser/Banking/Mt940/Engine/Abn.php b/src/Parser/Banking/Mt940/Engine/Abn.php index c1b447f..a03b261 100644 --- a/src/Parser/Banking/Mt940/Engine/Abn.php +++ b/src/Parser/Banking/Mt940/Engine/Abn.php @@ -30,7 +30,7 @@ protected function parseTransactionAccount() $results = parent::parseTransactionAccount(); if (empty($results)) { - $giroMatch = $ibanMatch = array(); + $giroMatch = $ibanMatch = []; if (preg_match('/^:86:GIRO(.{9})/im', $this->getCurrentTransactionData(), $giroMatch) && !empty($giroMatch[1]) ) { @@ -58,7 +58,7 @@ protected function parseTransactionAccountName() return $results; } - $results = array(); + $results = []; if (preg_match('/:86:(GIRO|BGC\.)\s+[\d]+ (.+)/', $this->getCurrentTransactionData(), $results) && !empty($results[2]) ) { @@ -82,7 +82,7 @@ protected function parseTransactionAccountName() */ protected function parseTransactionEntryTimestamp() { - $results = array(); + $results = []; if (preg_match('/^:61:\d{6}(\d{4})[C|D]/', $this->getCurrentTransactionData(), $results) && !empty($results[1]) ) { diff --git a/src/Parser/Banking/Mt940/Engine/Rabo.php b/src/Parser/Banking/Mt940/Engine/Rabo.php index 551b5bd..6f00455 100644 --- a/src/Parser/Banking/Mt940/Engine/Rabo.php +++ b/src/Parser/Banking/Mt940/Engine/Rabo.php @@ -25,7 +25,7 @@ protected function parseStatementBank() */ protected function parseTransactionAccount() { - $results = array(); + $results = []; // SEPA MT940 Structured if (preg_match('/^:61:.*\n(.*?)(\n|\:8)/im', $this->getCurrentTransactionData(), $results) && !empty($results[1]) @@ -47,7 +47,7 @@ protected function parseTransactionAccount() */ protected function parseTransactionAccountName() { - $results = array(); + $results = []; // SEPA MT940 Structured if (preg_match('#/NAME/(.*?)/(REMI|ADDR)/#ms', $this->getCurrentTransactionData(), $results) && !empty($results[1]) @@ -74,7 +74,7 @@ protected function parseTransactionAccountName() */ protected function parseTransactionEntryTimestamp() { - $results = array(); + $results = []; if (preg_match('/^:60F:[C|D]([\d]{6})/m', $this->getCurrentStatementData(), $results) && !empty($results[1])) { return $this->sanitizeTimestamp($results[1], 'ymd'); } @@ -88,7 +88,7 @@ protected function parseTransactionEntryTimestamp() */ protected function parseTransactionValueTimestamp() { - $results = array(); + $results = []; if (preg_match('/^:61:([\d]{6})[C|D]/', $this->getCurrentTransactionData(), $results) && !empty($results[1])) { return $this->sanitizeTimestamp($results[1], 'ymd'); } diff --git a/src/Parser/Banking/Mt940/Engine/Spk.php b/src/Parser/Banking/Mt940/Engine/Spk.php index 5ad8edf..ec2fc92 100644 --- a/src/Parser/Banking/Mt940/Engine/Spk.php +++ b/src/Parser/Banking/Mt940/Engine/Spk.php @@ -29,7 +29,7 @@ protected function parseStatementBank() */ protected function parseStatementStartPrice() { - $results = array(); + $results = []; if (preg_match('/:60[FM]:.*EUR([\d,\.]+)*/', $this->getCurrentStatementData(), $results) && !empty($results[1]) ) { @@ -45,7 +45,7 @@ protected function parseStatementStartPrice() */ protected function parseStatementTimestamp() { - $results = array(); + $results = []; if (preg_match('/:60[FM]:[C|D](\d{6})*/', $this->getCurrentStatementData(), $results) && !empty($results[1]) ) { @@ -61,7 +61,7 @@ protected function parseStatementTimestamp() */ protected function parseStatementEndPrice() { - $results = array(); + $results = []; if (preg_match('/:62[FM]:.*EUR([\d,\.]+)*/', $this->getCurrentStatementData(), $results) && !empty($results[1]) ) { @@ -77,7 +77,7 @@ protected function parseStatementEndPrice() */ protected function parseTransactionPrice() { - $results = array(); + $results = []; if (preg_match('/^:61:.*[CD].?([\d,\.]+)N/i', $this->getCurrentTransactionData(), $results) && !empty($results[1]) ) { @@ -93,7 +93,7 @@ protected function parseTransactionPrice() */ protected function parseTransactionDebitCredit() { - $results = array(); + $results = []; if (preg_match('/^:61:\d+R?([CD]).?\d+/', $this->getCurrentTransactionData(), $results) && !empty($results[1]) ) { diff --git a/src/Parser/Banking/Mt940/Engine/Triodos.php b/src/Parser/Banking/Mt940/Engine/Triodos.php index 1e37559..08bf61f 100644 --- a/src/Parser/Banking/Mt940/Engine/Triodos.php +++ b/src/Parser/Banking/Mt940/Engine/Triodos.php @@ -27,7 +27,7 @@ protected function parseStatementBank() */ protected function parseStatementAccount() { - $results = array(); + $results = []; if (preg_match('#:25:TRIODOSBANK/([\d\.]+)#', $this->getCurrentStatementData(), $results) && !empty($results[1]) ) { return $this->sanitizeAccount($results[1]); diff --git a/test/Banking/StatementTest.php b/test/Banking/StatementTest.php index 52e2ad1..b2c96e9 100644 --- a/test/Banking/StatementTest.php +++ b/test/Banking/StatementTest.php @@ -28,10 +28,10 @@ public function testAccountAssesor() public function testTransactionsAssesor() { - $expected = array( + $expected = [ new Transaction(), new Transaction(), - ); + ]; $statement = new Statement(); $statement->setTransactions($expected); @@ -94,10 +94,10 @@ public function testDeltaPrice() public function testAddTransaction() { $statement = new Statement(); - $statement->setTransactions(array( + $statement->setTransactions([ new Transaction(), new Transaction(), - )); + ]); $statement->addTransaction(new Transaction()); $this->assertCount(3, $statement->getTransactions()); @@ -119,15 +119,15 @@ public function testJsonSerialization() { $expected = '{"bank":"ABN","account":"62.90.64.393","transactions":[],"startPrice":16250,"endPrice":6250,' . '"timestamp":123,"number":"2665487AAF"}'; - $params = array( + $params = [ 'bank' => 'ABN', 'account' => '62.90.64.393', - 'transactions' => array(), + 'transactions' => [], 'startPrice' => 16250, 'endPrice' => 6250, 'timestamp' => 123, 'number' => '2665487AAF', - ); + ]; $statement = new Statement(); foreach ($params as $key => $value) { $statement->{'set' . $key}($value); @@ -145,11 +145,11 @@ public function testJsonSerializationWithTransactions() ':1234,"transactionCode":"13G"},{"account":"123123","accountName":"Kingsquare BV","price":110,"debitcredit"' . ':"D","description":"test","valueTimestamp":1231,"entryTimestamp":1234,"transactionCode":"13G"}],' . '"startPrice":16250,"endPrice":6250,"timestamp":123,"number":"2665487AAF"}'; - $params = array( + $params = [ 'bank' => 'ABN', 'account' => '62.90.64.393', - 'transactions' => array( - array( + 'transactions' => [ + [ 'account' => '123123', 'accountName' => 'Kingsquare BV', 'price' => 110.0, @@ -158,8 +158,8 @@ public function testJsonSerializationWithTransactions() 'valueTimestamp' => 1231, 'entryTimestamp' => 1234, 'transactionCode' => '13G', - ), - array( + ], + [ 'account' => '123123', 'accountName' => 'Kingsquare BV', 'price' => 110.0, @@ -168,13 +168,13 @@ public function testJsonSerializationWithTransactions() 'valueTimestamp' => 1231, 'entryTimestamp' => 1234, 'transactionCode' => '13G', - ), - ), + ], + ], 'startPrice' => 16250, 'endPrice' => 6250, 'timestamp' => 123, 'number' => '2665487AAF', - ); + ]; $statement = new Statement(); foreach ($params as $key => $value) { $statement->{'set' . $key}($value); diff --git a/test/Banking/TransactionTest.php b/test/Banking/TransactionTest.php index 9cb646b..2ca93ee 100644 --- a/test/Banking/TransactionTest.php +++ b/test/Banking/TransactionTest.php @@ -136,7 +136,7 @@ public function testJsonSerialization() $expected = '{"account":"123123","accountName":"Kingsquare BV","price":110,"debitcredit":"D",' . '"description":"test","valueTimestamp":1231,"entryTimestamp":1234,"transactionCode":"13G"}'; - $params = array( + $params = [ 'account' => '123123', 'accountName' => 'Kingsquare BV', 'price' => 110.0, @@ -145,7 +145,7 @@ public function testJsonSerialization() 'valueTimestamp' => 1231, 'entryTimestamp' => 1234, 'transactionCode' => '13G', - ); + ]; $statement = new Transaction(); foreach ($params as $key => $value) { $statement->{'set' . $key}($value); diff --git a/test/Parser/Banking/Mt940/DebitCreditTest.php b/test/Parser/Banking/Mt940/DebitCreditTest.php index 28c877b..981abcf 100644 --- a/test/Parser/Banking/Mt940/DebitCreditTest.php +++ b/test/Parser/Banking/Mt940/DebitCreditTest.php @@ -32,15 +32,15 @@ public function testDebitCredit($dOrC, $statement) */ public function statementProvider() { - return array( - array('D', ':61:030111D000000000500.00NMSC1173113681 ROBECO'), - array('C', ':61:100628C49,37NOV NONREF'), - array('D', ':61:100628D49,37this is a Testds'), - array('C', ':61:100628C49,37D is actually a'), - array('C', ':61:100628C36,07NVZ NONREF'), - array('C', ':61:1004080408C23,7N196NONREF'), - array('D', ':61:030109D000000000110.00NMSC644530030 INSTANT-LOTERY, STG.NAT'), - array('D', ':61:1004160416D1133,57N422NONREF'), - ); + return [ + ['D', ':61:030111D000000000500.00NMSC1173113681 ROBECO'], + ['C', ':61:100628C49,37NOV NONREF'], + ['D', ':61:100628D49,37this is a Testds'], + ['C', ':61:100628C49,37D is actually a'], + ['C', ':61:100628C36,07NVZ NONREF'], + ['C', ':61:1004080408C23,7N196NONREF'], + ['D', ':61:030109D000000000110.00NMSC644530030 INSTANT-LOTERY, STG.NAT'], + ['D', ':61:1004160416D1133,57N422NONREF'], + ]; } } diff --git a/test/Parser/Banking/Mt940/Engine/GetInstanceTest.php b/test/Parser/Banking/Mt940/Engine/GetInstanceTest.php index 06fc16d..071a4d1 100644 --- a/test/Parser/Banking/Mt940/Engine/GetInstanceTest.php +++ b/test/Parser/Banking/Mt940/Engine/GetInstanceTest.php @@ -28,6 +28,8 @@ public function testUnknownEngineRaisesANotice() /** * @dataProvider enginesProvider + * @param string $engineString + * @param string $source */ public function testEngine($engineString, $source) { @@ -40,13 +42,13 @@ public function testEngine($engineString, $source) */ public function enginesProvider() { - return array( - array('Abn', file_get_contents(__DIR__ . '/Abn/sample')), - array('Ing', file_get_contents(__DIR__ . '/Ing/sample')), - array('Rabo', file_get_contents(__DIR__ . '/Rabo/sample')), - array('Spk', file_get_contents(__DIR__ . '/Spk/sample')), - array('Triodos', file_get_contents(__DIR__ . '/Triodos/sample')), - array('Unknown', 'this is an unknown format :)'), - ); + return [ + ['Abn', file_get_contents(__DIR__ . '/Abn/sample')], + ['Ing', file_get_contents(__DIR__ . '/Ing/sample')], + ['Rabo', file_get_contents(__DIR__ . '/Rabo/sample')], + ['Spk', file_get_contents(__DIR__ . '/Spk/sample')], + ['Triodos', file_get_contents(__DIR__ . '/Triodos/sample')], + ['Unknown', 'this is an unknown format :)'], + ]; } } diff --git a/test/Parser/Banking/Mt940/Engine/ParseDescriptionTest.php b/test/Parser/Banking/Mt940/Engine/ParseDescriptionTest.php index e6d5d14..61a76e6 100644 --- a/test/Parser/Banking/Mt940/Engine/ParseDescriptionTest.php +++ b/test/Parser/Banking/Mt940/Engine/ParseDescriptionTest.php @@ -31,61 +31,61 @@ public function testDebitCredit($input, $expected) */ public function statementProvider() { - return array( - array(':86:This is a test', ''), - array( + return [ + [':86:This is a test', ''], + [ ' :86:This is a test', 'This is a test' - ), - array( + ], + [ ' :86:This is a test ', 'This is a test' - ), - array( + ], + [ ' :86:This is a test :', 'This is a test:' - ), - array( + ], + [ ' :86:This is a test :6', 'This is a test:6' - ), - array( + ], + [ ' :86:This is a test :61', 'This is a test' - ), - array( + ], + [ ' :86:This is a test :62', 'This is a test' - ), - array( + ], + [ ' :86:This is a test : 62', 'This is a test: 62' - ), - array( + ], + [ ' :86:Spaarpot kantine', 'Spaarpot kantine' - ), - array( + ], + [ ' :86: ABN AMRO BANK>AMSTERDAM S1P468 22­07­2010 09:57 002 5595781 ', 'ABN AMRO BANK>AMSTERDAM S1P46822­07­2010 09:57 002 5595781' - ), - ); + ], + ]; } } diff --git a/test/Parser/Banking/Mt940/Engine/Spk/ParseTest.php b/test/Parser/Banking/Mt940/Engine/Spk/ParseTest.php index 9ec91f5..3a67caa 100644 --- a/test/Parser/Banking/Mt940/Engine/Spk/ParseTest.php +++ b/test/Parser/Banking/Mt940/Engine/Spk/ParseTest.php @@ -37,7 +37,7 @@ public function testHasTheRightAmountOfTransactions() { $statements = $this->engine->parse(); $this->assertSame(4, count($statements)); - $tranactions = array(); + $tranactions = []; foreach ($statements as $statement) { $tranactions = array_merge($tranactions, $statement->getTransactions()); } diff --git a/test/Parser/Banking/Mt940/Engine/Triodos/ParseTest.php b/test/Parser/Banking/Mt940/Engine/Triodos/ParseTest.php index 8c6ab46..32a7846 100644 --- a/test/Parser/Banking/Mt940/Engine/Triodos/ParseTest.php +++ b/test/Parser/Banking/Mt940/Engine/Triodos/ParseTest.php @@ -38,10 +38,10 @@ public function testBankFromStatement() public function testAccountFromStatement() { /* @var Statement $statement */ - $known = array( + $known = [ '666666666', '999999999', - ); + ]; foreach ($this->statements as $i => $statement) { $this->assertSame($known[$i], $statement->getAccount()); } @@ -50,10 +50,10 @@ public function testAccountFromStatement() public function testStartPriceFromStatement() { /* @var Statement $statement */ - $known = array( + $known = [ 1000.0, 950.12, - ); + ]; foreach ($this->statements as $i => $statement) { $this->assertSame($known[$i], $statement->getStartPrice()); } @@ -62,10 +62,10 @@ public function testStartPriceFromStatement() public function testEndPriceFromStatement() { /* @var Statement $statement */ - $known = array( + $known = [ 850.0, 1009.14, - ); + ]; foreach ($this->statements as $i => $statement) { $this->assertSame($known[$i], $statement->getEndPrice()); } @@ -74,10 +74,10 @@ public function testEndPriceFromStatement() public function testTimestampFromStatement() { /* @var Statement $statement */ - $known = array( + $known = [ '121123', '121123', - ); + ]; foreach ($this->statements as $i => $statement) { $this->assertSame($known[$i], $statement->getTimestamp('ymd')); } diff --git a/test/Parser/Banking/Mt940/Engine/Triodos/TransactionTest.php b/test/Parser/Banking/Mt940/Engine/Triodos/TransactionTest.php index 9c28957..628bdd0 100644 --- a/test/Parser/Banking/Mt940/Engine/Triodos/TransactionTest.php +++ b/test/Parser/Banking/Mt940/Engine/Triodos/TransactionTest.php @@ -2,7 +2,6 @@ namespace Kingsquare\Parser\Banking\Mt940\Engine\Triodos; -use Kingsquare\Banking\Statement; use Kingsquare\Banking\Transaction; use Kingsquare\Parser\Banking\Mt940\Engine\Triodos; @@ -14,7 +13,7 @@ class TransactionTest extends \PHPUnit_Framework_TestCase /** * @var Transaction[] */ - private $transactions = array(); + private $transactions = []; protected function setUp() { @@ -33,7 +32,7 @@ public function testParsesAllFoundStatements() public function testAccount() { /* @var Transaction $transaction */ - $known = array( + $known = [ '555555555', '555555555', '555555555', @@ -42,7 +41,7 @@ public function testAccount() '888888888', '888888888', '888888888', - ); + ]; foreach ($this->transactions as $i => $transaction) { $this->assertSame($known[$i], $transaction->getAccount()); } @@ -59,7 +58,7 @@ public function testAccountName() public function testPrice() { /* @var Transaction $transaction */ - $known = array( + $known = [ 10.0, 250.0, 150.0, @@ -68,7 +67,7 @@ public function testPrice() 25.25, 150.0, 56.78, - ); + ]; foreach ($this->transactions as $i => $transaction) { $this->assertSame($known[$i], $transaction->getPrice()); } @@ -77,7 +76,7 @@ public function testPrice() public function testDebitCredit() { /* @var Transaction $transaction */ - $known = array( + $known = [ Transaction::DEBIT, Transaction::DEBIT, Transaction::CREDIT, @@ -86,7 +85,7 @@ public function testDebitCredit() Transaction::DEBIT, Transaction::CREDIT, Transaction::DEBIT, - ); + ]; foreach ($this->transactions as $i => $transaction) { $this->assertSame($known[$i], $transaction->getDebitCredit()); } @@ -95,7 +94,7 @@ public function testDebitCredit() public function testDescription() { /* @var Transaction $transaction */ - $known = array( + $known = [ 'TENAAMSTELLING TEGENREKENING EN ADRES TEGENREKENING EN PLAATS TEGENREKENING EN EEN LANGE OMSCHRIJVING VAN DE TRANSACTIE', 'TENAAMSTELLING TEGENREKENING 1111222233334444', 'TENAAMSTELLING TEGENREKENING EN ADRES TEGENREKENING EN PLAATS TEGENREKENING EN EEN LANGE OMSCHRIJVING VAN DE TRANSACTIE', @@ -104,7 +103,7 @@ public function testDescription() 'TENAAMSTELLING TEGENREKENING 1111222233334444', 'TENAAMSTELLING TEGENREKENING EN ADRES TEGENREKENING EN PLAATS TEGENREKENING EN EEN LANGE OMSCHRIJVING VAN DE TRANSACTIE', 'TENAAMSTELLING TEGENREKENING EN ADRES TEGENREKENING EN PLAATS TEGENREKENING EN EEN LANGE OMSCHRIJVING VAN DE TRANSACTIE 1111222233334444', - ); + ]; foreach ($this->transactions as $i => $transaction) { $this->assertSame($known[$i], $transaction->getDescription()); } diff --git a/test/Parser/Banking/Mt940/ParseTest.php b/test/Parser/Banking/Mt940/ParseTest.php index 161a338..c8429a1 100644 --- a/test/Parser/Banking/Mt940/ParseTest.php +++ b/test/Parser/Banking/Mt940/ParseTest.php @@ -14,6 +14,6 @@ class ParseTest extends \PHPUnit_Framework_TestCase public function testParseReturnsArrayOnEmptySource() { $parser = new Mt940(); - $this->assertEquals(array(), $parser->parse('')); + $this->assertEquals([], $parser->parse('')); } }