Completed
Pull Request — master (#32)
by Sullivan
03:15
created

AbstractResponse::getComment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Nexy\PayboxDirect\Response;
4
5
/**
6
 * @author Sullivan Senechal <[email protected]>
7
 */
8
abstract class AbstractResponse implements ResponseInterface
9
{
10
    /**
11
     * @var int
12
     */
13
    private $code;
14
15
    /**
16
     * @var string
17
     */
18
    private $comment;
19
20
    /**
21
     * @var string
22
     */
23
    private $site;
24
25
    /**
26
     * @var string
27
     */
28
    private $rank;
29
30
    /**
31
     * @var int
32
     */
33
    private $callNumber;
34
35
    /**
36
     * @var int
37
     */
38
    private $questionNumber;
39
40
    /**
41
     * @var int
42
     */
43
    private $transactionNumber;
44
45
    /**
46
     * @var string|null
47
     */
48
    private $sha1 = null;
49
50
    /**
51
     * @param string[] $data
52
     */
53
    public function __construct(array $data)
54
    {
55
        $this->code = intval($data['CODEREPONSE']);
56
        $this->comment = $data['COMMENTAIRE'];
57
        $this->site = $data['SITE'];
58
        $this->rank = $data['RANG'];
59
        $this->callNumber = intval($data['NUMAPPEL']);
60
        $this->questionNumber = intval($data['NUMQUESTION']);
61
        $this->transactionNumber = intval($data['NUMTRANS']);
62
63
        if (array_key_exists('SHA-1', $data)) {
64
            $this->sha1 = $data['SHA-1'];
65
        }
66
    }
67
68
    /**
69
     * @return int
70
     */
71
    final public function getCode()
72
    {
73
        return $this->code;
74
    }
75
76
    /**
77
     * @return string
78
     */
79
    final public function getComment()
80
    {
81
        return $this->comment;
82
    }
83
84
    /**
85
     * @return string
86
     */
87
    final public function getSite()
88
    {
89
        return $this->site;
90
    }
91
92
    /**
93
     * @return string
94
     */
95
    final public function getRank()
96
    {
97
        return $this->rank;
98
    }
99
100
    /**
101
     * @return int
102
     */
103
    final public function getCallNumber()
104
    {
105
        return $this->callNumber;
106
    }
107
108
    /**
109
     * @return int
110
     */
111
    final public function getQuestionNumber()
112
    {
113
        return $this->questionNumber;
114
    }
115
116
    /**
117
     * @return int
118
     */
119
    final public function getTransactionNumber()
120
    {
121
        return $this->transactionNumber;
122
    }
123
124
    /**
125
     * @return string|null
126
     */
127
    final public function getSha1()
128
    {
129
        return $this->sha1;
130
    }
131
}
132