Completed
Push — master ( d72bee...4d3436 )
by Frederik
03:38
created

Entry   A

Complexity

Total Complexity 26

Size/Duplication

Total Lines 276
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 66.13%

Importance

Changes 0
Metric Value
wmc 26
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 276
ccs 41
cts 62
cp 0.6613
rs 10

25 Methods

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