Passed
Pull Request — master (#76)
by
unknown
02:09
created

Penta   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 9
c 1
b 0
f 1
dl 0
loc 39
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isApplicable() 0 5 1
A parseStatementData() 0 10 1
A parseStatementBank() 0 3 1
1
<?php
2
3
namespace Kingsquare\Parser\Banking\Mt940\Engine;
4
5
use Kingsquare\Parser\Banking\Mt940\Engine;
6
7
/**
8
 * @author Kingsquare ([email protected])
9
 * @license http://opensource.org/licenses/MIT MIT
10
 */
11
class Penta extends Engine
12
{
13
    /**
14
     * returns the name of the bank.
15
     *
16
     * @return string
17
     */
18
    protected function parseStatementBank()
19
    {
20
        return 'PENTA';
21
    }
22
23
    /**
24
     * split the rawdata up into statementdata chunks.
25
     *
26
     * @return array
27
     */
28
    protected function parseStatementData()
29
    {
30
        $results = preg_split(
31
            '/(^:20:|^-X{,3}$|\Z)/m',
32
            $this->getRawData(),
33
            -1,
34
            PREG_SPLIT_NO_EMPTY
35
        );
36
37
        return $results;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $results could also return false which is incompatible with the documented return type array. Did you maybe forget to handle an error condition?

If the returned type also contains false, it is an indicator that maybe an error condition leading to the specific return statement remains unhandled.

Loading history...
38
    }
39
40
    /**
41
     * Overloaded: Is applicable if second line has :25:TRIODOSBANK.
42
     *
43
     * @inheritdoc
44
     */
45
    public static function isApplicable($string)
46
    {
47
        $firstline = strtok($string, "\r\n\t");
48
49
        return strpos($firstline, 'PENTA') !== false;
50
    }
51
}
52