Kontist   A
last analyzed

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 parseStatementData() 0 10 1
A parseStatementBank() 0 3 1
A isApplicable() 0 5 1
1
<?php
2
3
namespace Kingsquare\Parser\Banking\Mt940\Engine;
4
5
use Kingsquare\Parser\Banking\Mt940\Engine;
6
7
/**
8
 * @author Sevan Nerse ([email protected])
9
 * @license http://opensource.org/licenses/MIT MIT
10
 */
11
class Kontist extends Engine
12
{
13
    /**
14
     * returns the name of the bank.
15
     *
16
     * @return string
17
     */
18
    protected function parseStatementBank()
19
    {
20
        return 'KONTIST';
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;
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, 'KONTIST') !== false;
50
    }
51
}
52