HNHBK   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
dl 0
loc 39
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1
ccs 14
cts 16
cp 0.875
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 18 2
A getName() 0 4 1
1
<?php
2
3
namespace Fhp\Segment;
4
5
/**
6
 * Class HNHBK (Nachrichtenkopf)
7
 * Segment type: Administration
8
 *
9
 * @link: http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Formals_2011-06-14_final_version.pdf
10
 * Section: B.5.2
11
 *
12
 * @package Fhp\Segment
13
 */
14
class HNHBK extends AbstractSegment
15
{
16
    const NAME = 'HNHBK';
17
    const VERSION = 3;
18
    const HEADER_LENGTH = 29;
19
20
    /**
21
     * HNHBK constructor.
22
     * @param string $messageLength
23
     * @param string $dialogId
24
     * @param int $messageNumber
25
     */
26 2
    public function __construct($messageLength, $dialogId, $messageNumber)
27
    {
28 2
        if (strlen($messageLength) != 12) {
29 2
            $messageLength = str_pad((int) $messageLength + static::HEADER_LENGTH + strlen($dialogId) + strlen($messageNumber), 12, '0', STR_PAD_LEFT);
30 2
        }
31
32 2
        parent::__construct(
33 2
            static::NAME,
34 2
            1, // always the first segment
35 2
            static::VERSION,
36
            array(
37 2
                $messageLength,
38 2
                300, // HBCI / FINTS version 3.0,
39 2
                $dialogId,
40 2
                $messageNumber,
41
            )
42 2
        );
43 2
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function getName()
49
    {
50
        return static::NAME;
51
    }
52
}
53