Completed
Push — master ( a5ff2b...bf9940 )
by Yann
05:35
created

Entry::getIndex()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

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
eloc 2
nc 1
nop 0
crap 2
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
    /**
21
     * @var Money
22
     */
23
    private $amount;
24
25
    /**
26
     * @var DateTimeImmutable
27
     */
28
    private $bookingDate;
29
30
    /**
31
     * @var DateTimeImmutable
32
     */
33
    private $valueDate;
34
35
    /**
36
     * @var EntryTransactionDetail[]
37
     */
38
    private $transactionDetails = [];
39
40
    /**
41
     * @var bool
42
     */
43
    private $reversalIndicator = false;
44
45
    /**
46
     * @var string
47
     */
48
    private $reference;
49
50
    /**
51
     * @var string
52
     */
53
    private $accountServicerReference;
54
55
    /**
56
     * @var int
57
     */
58
    private $index;
59
60
    /**
61
     * @var string
62
     */
63
    private $batchPaymentId;
64
65
    /**
66
     * @var string
67
     */
68
    private $additionalInfo;
69
70
    /**
71
     * @var BankTransactionCode
72
     */
73
    private $bankTransactionCode;
74
75
    /**
76
     * @var Charges
77
     */
78
    private $charges;
79
80
    /**
81
     * @param Record $record
82
     * @param int $index
83
     * @param Money $amount
84
     * @param DateTimeImmutable $bookingDate
85
     * @param DateTimeImmutable $valueDate
86
     */
87 21
    public function __construct(Record $record, $index, Money $amount, DateTimeImmutable $bookingDate, DateTimeImmutable $valueDate, $additionalInfo)
88
    {
89 21
        $this->record = $record;
90 21
        $this->index = $index;
91 21
        $this->amount = $amount;
92 21
        $this->bookingDate = $bookingDate;
93 21
        $this->valueDate = $valueDate;
94 21
        $this->additionalInfo = $additionalInfo;
95 21
    }
96
97
    /**
98
     * @return Record
99
     */
100
    public function getRecord()
101
    {
102
        return $this->record;
103
    }
104
105
    /**
106
     * @return Money
107
     */
108 4
    public function getAmount()
109
    {
110 4
        return $this->amount;
111
    }
112
113
    /**
114
     * @return DateTimeImmutable
115
     */
116 3
    public function getBookingDate()
117
    {
118 3
        return $this->bookingDate;
119
    }
120
121
    /**
122
     * @return DateTimeImmutable
123
     */
124 3
    public function getValueDate()
125
    {
126 3
        return $this->valueDate;
127
    }
128
129
    /**
130
     * @param EntryTransactionDetail $detail
131
     */
132 20
    public function addTransactionDetail(EntryTransactionDetail $detail)
133
    {
134 20
        $this->transactionDetails[] = $detail;
135 20
    }
136
137
    /**
138
     * @return EntryTransactionDetail[]
139
     */
140 5
    public function getTransactionDetails()
141
    {
142 5
        return $this->transactionDetails;
143
    }
144
145
    /**
146
     * @return EntryTransactionDetail
147
     */
148 2
    public function getTransactionDetail()
149
    {
150 2
        if (isset($this->transactionDetails[0])) {
151 2
            return $this->transactionDetails[0];
152
        } else {
153
            throw new BadMethodCallException('There are no transaction details at all for this entry');
154
        }
155
    }
156
157
    /**
158
     * @return bool
159
     */
160
    public function getReversalIndicator()
161
    {
162
        return $this->reversalIndicator;
163
    }
164
165
    /**
166
     * @param boolean $reversalIndicator
167
     */
168 1
    public function setReversalIndicator($reversalIndicator)
169
    {
170 1
        $this->reversalIndicator = $reversalIndicator;
171 1
    }
172
173
    /**
174
     * @return string
175
     */
176
    public function getReference()
177
    {
178
        return $this->reference;
179
    }
180
181
    /**
182
     * @param string $reference
183
     */
184 1
    public function setReference($reference)
185
    {
186 1
        $this->reference = $reference;
187 1
    }
188
189
    /**
190
     * Unique reference as assigned by the account servicing institution to unambiguously identify the entry.
191
     * @return string
192
     */
193
    public function getAccountServicerReference()
194
    {
195
        return $this->accountServicerReference;
196
    }
197
198
    /**
199
     * @param string $accountServicerReference
200
     */
201 18
    public function setAccountServicerReference($accountServicerReference)
202
    {
203 18
        $this->accountServicerReference = $accountServicerReference;
204 18
    }
205
206
    /**
207
     * @return int
208
     */
209
    public function getIndex()
210
    {
211
        return $this->index;
212
    }
213
214
    /**
215
     * @param string $batchPaymentId
216
     */
217 11
    public function setBatchPaymentId($batchPaymentId)
218
    {
219 11
        $this->batchPaymentId = trim($batchPaymentId);
220 11
    }
221
222
    /**
223
     * @return string
224
     */
225
    public function getBatchPaymentId()
226
    {
227
        return $this->batchPaymentId;
228
    }
229
230
    /**
231
     * @return string
232
     */
233 1
    public function getAdditionalInfo()
234
    {
235 1
        return $this->additionalInfo;
236
    }
237
238
    /**
239
     * @param string $additionalInfo
240
     */
241
    public function setAdditionalInfo($additionalInfo)
242
    {
243
        $this->additionalInfo = $additionalInfo;
244
    }
245
246
    /**
247
     * @return BankTransactionCode
248
     */
249 1
    public function getBankTransactionCode()
250
    {
251 1
        return $this->bankTransactionCode;
252
    }
253
254
    /**
255
     * @param BankTransactionCode $bankTransactionCode
256
     */
257 20
    public function setBankTransactionCode(BankTransactionCode $bankTransactionCode)
258
    {
259 20
        $this->bankTransactionCode = $bankTransactionCode;
260 20
    }
261
    
262
    /**
263
     * @return Charges
264
     */
265
    public function getCharges()
266
    {
267
        return $this->charges;
268
    }
269
270
    /**
271
     * @param Charges $charges
272
     */
273
    public function setCharges(Charges $charges)
274
    {
275
        $this->charges = $charges;
276
    }
277
    
278
}
279