HNVSK::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Fhp\Segment;
4
5
use Fhp\DataElementGroups\EncryptionAlgorithm;
6
use Fhp\DataElementGroups\KeyName;
7
use Fhp\DataElementGroups\SecurityDateTime;
8
use Fhp\DataElementGroups\SecurityIdentificationDetails;
9
use Fhp\DataElementGroups\SecurityProfile;
10
11
/**
12
 * Class HNVSK (Verschlüsselungskopf)
13
 * Segment type: Administration
14
 *
15
 * @link: http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Security_Sicherheitsverfahren_HBCI_Rel_20130718_final_version.pdf
16
 * Section: B.5.3
17
 *
18
 * @package Fhp\Segment
19
 */
20
class HNVSK extends AbstractSegment
21
{
22
    const NAME = 'HNVSK';
23
    const VERSION = 3;
24
25
    const SECURITY_SUPPLIER_ROLE_ISS = 1;
26
    const SECURITY_SUPPLIER_ROLE_CON = 3;
27
    const SECURITY_SUPPLIER_ROLE_WIT = 4;
28
29
    const COMPRESSION_NONE = 0;
30
    const COMPRESSION_LZW = 1;
31
    const COMPRESSION_COM = 2;
32
    const COMPRESSION_LZSS = 3;
33
    const COMPRESSION_LZHUFF = 4;
34
    const COMPRESSION_ZIP = 5;
35
    const COMPRESSION_GZIP = 6;
36
    const COMPRESSION_BZIP2 = 7;
37
    const COMPRESSION_NEGOTIATE = 999;
38
39
    /**
40
     * HNVSK constructor.
41
     * @param int $segmentNumber
42
     * @param string $bankCode
43
     * @param string $userName
44
     * @param int $systemId
45
     * @param int $securitySupplierRole
46
     * @param int $countryCode
47
     * @param int $compression
48
     * @param int $pinTanVersion
49
     */
50 4
    public function __construct(
51
        $segmentNumber,
52
        $bankCode,
53
        $userName,
54
        $systemId = 0,
55
        $securitySupplierRole = self::SECURITY_SUPPLIER_ROLE_ISS,
56
        $countryCode = self::DEFAULT_COUNTRY_CODE,
57
        $compression = self::COMPRESSION_NONE,
58
        $pinTanVersion = SecurityProfile::PROFILE_VERSION_1
59
    ) {
60 4
        parent::__construct(
61 4
            static::NAME,
62 4
            $segmentNumber,
63 4
            static::VERSION,
64
            array(
65 4
                new SecurityProfile(SecurityProfile::PROFILE_PIN, $pinTanVersion),
66 4
                998, // Just informational / invalid for PIN/TAN,
67 4
                $securitySupplierRole,
68 4
                new SecurityIdentificationDetails(SecurityIdentificationDetails::CID_NONE, $systemId),
69 4
                new SecurityDateTime(),
70 4
                new EncryptionAlgorithm(),
71 4
                new KeyName($countryCode, $bankCode, $userName),
72 4
                $compression,
73
            )
74 4
        );
75 4
    }
76
77
    /**
78
     * @return string
79
     */
80
    public function getName()
81
    {
82
        return static::NAME;
83
    }
84
}
85