Completed
Push — master ( 4d3436...c8d1ff )
by Hanish
11s queued 10s
created

Entry::getReference()   A

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 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
     */
85 21
    public function __construct(Record $record, $index, Money $amount)
86
    {
87 21
        $this->record = $record;
88 21
        $this->index = $index;
89 21
        $this->amount = $amount;
90 21
    }
91
92
    /**
93
     * @return Record
94
     */
95
    public function getRecord()
96
    {
97
        return $this->record;
98
    }
99
100
    /**
101
     * @return Money
102
     */
103 4
    public function getAmount()
104
    {
105 4
        return $this->amount;
106
    }
107
108
    /**
109
     * @return DateTimeImmutable
110
     */
111 3
    public function getBookingDate()
112
    {
113 3
        return $this->bookingDate;
114
    }
115
116
    /**
117
     * @return DateTimeImmutable
118
     */
119 3
    public function getValueDate()
120
    {
121 3
        return $this->valueDate;
122
    }
123
124
    /**
125
     * @param EntryTransactionDetail $detail
126
     */
127 20
    public function addTransactionDetail(EntryTransactionDetail $detail)
128
    {
129 20
        $this->transactionDetails[] = $detail;
130 20
    }
131
132
    /**
133
     * @return EntryTransactionDetail[]
134
     */
135 5
    public function getTransactionDetails()
136
    {
137 5
        return $this->transactionDetails;
138
    }
139
140
    /**
141
     * @return EntryTransactionDetail
142
     */
143 2
    public function getTransactionDetail()
144
    {
145 2
        if (isset($this->transactionDetails[0])) {
146 2
            return $this->transactionDetails[0];
147
        } else {
148
            throw new BadMethodCallException('There are no transaction details at all for this entry');
149
        }
150
    }
151
152
    /**
153
     * @return bool
154
     */
155
    public function getReversalIndicator()
156
    {
157
        return $this->reversalIndicator;
158
    }
159
160
    /**
161
     * @param boolean $reversalIndicator
162
     */
163 1
    public function setReversalIndicator($reversalIndicator)
164
    {
165 1
        $this->reversalIndicator = $reversalIndicator;
166 1
    }
167
168
    /**
169
     * @return string
170
     */
171
    public function getReference()
172
    {
173
        return $this->reference;
174
    }
175
176
    /**
177
     * @param string $reference
178
     */
179 1
    public function setReference($reference)
180
    {
181 1
        $this->reference = $reference;
182 1
    }
183
184
    /**
185
     * Unique reference as assigned by the account servicing institution to unambiguously identify the entry.
186
     * @return string
187
     */
188
    public function getAccountServicerReference()
189
    {
190
        return $this->accountServicerReference;
191
    }
192
193
    /**
194
     * @param string $accountServicerReference
195
     */
196 18
    public function setAccountServicerReference($accountServicerReference)
197
    {
198 18
        $this->accountServicerReference = $accountServicerReference;
199 18
    }
200
201
    /**
202
     * @return int
203
     */
204
    public function getIndex()
205
    {
206
        return $this->index;
207
    }
208
209
    /**
210
     * @param string $batchPaymentId
211
     */
212 11
    public function setBatchPaymentId($batchPaymentId)
213
    {
214 11
        $this->batchPaymentId = trim($batchPaymentId);
215 11
    }
216
217
    /**
218
     * @return string
219
     */
220
    public function getBatchPaymentId()
221
    {
222
        return $this->batchPaymentId;
223
    }
224
225
    /**
226
     * @return string
227
     */
228 1
    public function getAdditionalInfo()
229
    {
230 1
        return $this->additionalInfo;
231
    }
232
233
    /**
234
     * @param string $additionalInfo
235
     */
236 21
    public function setAdditionalInfo($additionalInfo)
237
    {
238 21
        $this->additionalInfo = $additionalInfo;
239 21
    }
240
241
    /**
242
     * @return BankTransactionCode
243
     */
244 2
    public function getBankTransactionCode()
245
    {
246 2
        return $this->bankTransactionCode;
247
    }
248
249
    /**
250
     * @param BankTransactionCode $bankTransactionCode
251
     */
252 20
    public function setBankTransactionCode(BankTransactionCode $bankTransactionCode)
253
    {
254 20
        $this->bankTransactionCode = $bankTransactionCode;
255 20
    }
256
257
    /**
258
     * @return Charges
259
     */
260
    public function getCharges()
261
    {
262
        return $this->charges;
263
    }
264
265
    /**
266
     * @param Charges $charges
267
     */
268
    public function setCharges(Charges $charges)
269
    {
270
        $this->charges = $charges;
271
    }
272
273
    /**
274
     * @param \DateTimeImmutable $date
275
     */
276 20
    public function setBookingDate(\DateTimeImmutable $date)
277
    {
278 20
        $this->bookingDate = $date;
279 20
    }
280
281
    /**
282
     * @param \DateTimeImmutable $date
283
     */
284 20
    public function setValueDate(\DateTimeImmutable $date)
285
    {
286 20
        $this->valueDate = $date;
287 20
    }
288
}
289