Completed
Push — master ( 2a5d10...02ca86 )
by Frederik
02:43
created

Entry::getAdditionalInfo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Genkgo\Camt\DTO;
4
5
use BadMethodCallException;
6
use DateTimeImmutable;
7
use Money\Money;
8
9
/**
10
 * Class Entry
11
 * @package Genkgo\Camt\DTO
12
 */
13
class Entry
14
{
15
    /**
16
     * @var Record
17
     */
18
    private $record;
19
    /**
20
     * @var Money
21
     */
22
    private $amount;
23
    /**
24
     * @var DateTimeImmutable
25
     */
26
    private $bookingDate;
27
    /**
28
     * @var DateTimeImmutable
29
     */
30
    private $valueDate;
31
    /**
32
     * @var EntryTransactionDetail[]
33
     */
34
    private $transactionDetails = [];
35
    /**
36
     * @var bool
37
     */
38
    private $reversalIndicator = false;
39
    /**
40
     * @var string
41
     */
42
    private $reference;
43
    /**
44
     * @var string
45
     */
46
    private $accountServicerReference;
47
    /**
48
     * @var int
49
     */
50
    private $index;
51
    /**
52
     * @var string
53
     */
54
    private $batchPaymentId;
55
    /**
56
     * @var string
57
     */
58
    private $additionalInfo;
59
60
    /**
61
     * @param Record $record
62
     * @param int $index
63
     * @param Money $amount
64
     * @param DateTimeImmutable $bookingDate
65
     * @param DateTimeImmutable $valueDate
66
     */
67 17
    public function __construct(Record $record, $index, Money $amount, DateTimeImmutable $bookingDate, DateTimeImmutable $valueDate, $additionalInfo)
68
    {
69 17
        $this->record = $record;
70 17
        $this->index = $index;
71 17
        $this->amount = $amount;
72 17
        $this->bookingDate = $bookingDate;
73 17
        $this->valueDate = $valueDate;
74 17
        $this->additionalInfo = $additionalInfo;
75 17
    }
76
77
    /**
78
     * @return Record
79
     */
80
    public function getRecord()
81
    {
82
        return $this->record;
83
    }
84
85
    /**
86
     * @return Money
87
     */
88 4
    public function getAmount()
89
    {
90 4
        return $this->amount;
91
    }
92
93
    /**
94
     * @return DateTimeImmutable
95
     */
96 3
    public function getBookingDate()
97
    {
98 3
        return $this->bookingDate;
99
    }
100
101
    /**
102
     * @return DateTimeImmutable
103
     */
104 3
    public function getValueDate()
105
    {
106 3
        return $this->valueDate;
107
    }
108
109
    /**
110
     * @param EntryTransactionDetail $detail
111
     */
112 16
    public function addTransactionDetail(EntryTransactionDetail $detail)
113
    {
114 16
        $this->transactionDetails[] = $detail;
115 16
    }
116
117
    /**
118
     * @return EntryTransactionDetail[]
119
     */
120 2
    public function getTransactionDetails()
121
    {
122 2
        return $this->transactionDetails;
123
    }
124
125
    /**
126
     * @return EntryTransactionDetail
127
     */
128 1
    public function getTransactionDetail()
129
    {
130 1
        if (isset($this->transactionDetails[0])) {
131 1
            return $this->transactionDetails[0];
132
        } else {
133
            throw new BadMethodCallException('There are no transaction details at all for this entry');
134
        }
135
    }
136
137
    /**
138
     * @return bool
139
     */
140
    public function getReversalIndicator()
141
    {
142
        return $this->reversalIndicator;
143
    }
144
145
    /**
146
     * @param boolean $reversalIndicator
147
     */
148 1
    public function setReversalIndicator($reversalIndicator)
149
    {
150 1
        $this->reversalIndicator = $reversalIndicator;
151 1
    }
152
153
    /**
154
     * @return string
155
     */
156
    public function getReference()
157
    {
158
        return $this->reference;
159
    }
160
161
    /**
162
     * @param string $reference
163
     */
164 1
    public function setReference($reference)
165
    {
166 1
        $this->reference = $reference;
167 1
    }
168
169
    /**
170
     * Unique reference as assigned by the account servicing institution to unambiguously identify the entry.
171
     * @return string
172
     */
173
    public function getAccountServicerReference()
174
    {
175
        return $this->accountServicerReference;
176
    }
177
178
    /**
179
     * @param string $accountServicerReference
180
     */
181 14
    public function setAccountServicerReference($accountServicerReference)
182
    {
183 14
        $this->accountServicerReference = $accountServicerReference;
184 14
    }
185
186
    /**
187
     * @return int
188
     */
189
    public function getIndex()
190
    {
191
        return $this->index;
192
    }
193
194
    /**
195
     * @param string $batchPaymentId
196
     */
197 7
    public function setBatchPaymentId($batchPaymentId)
198
    {
199 7
        $this->batchPaymentId = trim($batchPaymentId);
200 7
    }
201
202
    /**
203
     * @return string
204
     */
205
    public function getBatchPaymentId()
206
    {
207
        return $this->batchPaymentId;
208
    }
209
210
    /**
211
     * @return string
212
     */
213 1
    public function getAdditionalInfo()
214
    {
215 1
        return $this->additionalInfo;
216
    }
217
218
    /**
219
     * @param string $additionalInfo
220
     */
221
    public function setAdditionalInfo($additionalInfo)
222
    {
223
        $this->additionalInfo = $additionalInfo;
224
    }
225
}
226