Completed
Pull Request — master (#31)
by
unknown
20:56
created

Entry::getBankTransactionCode()   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 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
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
     * @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
     * @var BankTransactionCode
61
     */
62
    private $bankTransactionCode;
63
64
    /**
65
     * @param Record $record
66
     * @param int $index
67 19
     * @param Money $amount
68
     * @param DateTimeImmutable $bookingDate
69 19
     * @param DateTimeImmutable $valueDate
70 19
     */
71 19
    public function __construct(Record $record, $index, Money $amount, DateTimeImmutable $bookingDate, DateTimeImmutable $valueDate, $additionalInfo)
72 19
    {
73 19
        $this->record = $record;
74 19
        $this->index = $index;
75 19
        $this->amount = $amount;
76
        $this->bookingDate = $bookingDate;
77
        $this->valueDate = $valueDate;
78
        $this->additionalInfo = $additionalInfo;
79
    }
80
81
    /**
82
     * @return Record
83
     */
84
    public function getRecord()
85
    {
86
        return $this->record;
87
    }
88 4
89
    /**
90 4
     * @return Money
91
     */
92
    public function getAmount()
93
    {
94
        return $this->amount;
95
    }
96 3
97
    /**
98 3
     * @return DateTimeImmutable
99
     */
100
    public function getBookingDate()
101
    {
102
        return $this->bookingDate;
103
    }
104 3
105
    /**
106 3
     * @return DateTimeImmutable
107
     */
108
    public function getValueDate()
109
    {
110
        return $this->valueDate;
111
    }
112 18
113
    /**
114 18
     * @param EntryTransactionDetail $detail
115 18
     */
116
    public function addTransactionDetail(EntryTransactionDetail $detail)
117
    {
118
        $this->transactionDetails[] = $detail;
119
    }
120 3
121
    /**
122 3
     * @return EntryTransactionDetail[]
123
     */
124
    public function getTransactionDetails()
125
    {
126
        return $this->transactionDetails;
127
    }
128 2
129
    /**
130 2
     * @return EntryTransactionDetail
131 2
     */
132
    public function getTransactionDetail()
133
    {
134
        if (isset($this->transactionDetails[0])) {
135
            return $this->transactionDetails[0];
136
        } else {
137
            throw new BadMethodCallException('There are no transaction details at all for this entry');
138
        }
139
    }
140
141
    /**
142
     * @return bool
143
     */
144
    public function getReversalIndicator()
145
    {
146
        return $this->reversalIndicator;
147
    }
148 1
149
    /**
150 1
     * @param boolean $reversalIndicator
151 1
     */
152
    public function setReversalIndicator($reversalIndicator)
153
    {
154
        $this->reversalIndicator = $reversalIndicator;
155
    }
156
157
    /**
158
     * @return string
159
     */
160
    public function getReference()
161
    {
162
        return $this->reference;
163
    }
164 1
165
    /**
166 1
     * @param string $reference
167 1
     */
168
    public function setReference($reference)
169
    {
170
        $this->reference = $reference;
171
    }
172
173
    /**
174
     * Unique reference as assigned by the account servicing institution to unambiguously identify the entry.
175
     * @return string
176
     */
177
    public function getAccountServicerReference()
178
    {
179
        return $this->accountServicerReference;
180
    }
181 16
182
    /**
183 16
     * @param string $accountServicerReference
184 16
     */
185
    public function setAccountServicerReference($accountServicerReference)
186
    {
187
        $this->accountServicerReference = $accountServicerReference;
188
    }
189
190
    /**
191
     * @return int
192
     */
193
    public function getIndex()
194
    {
195
        return $this->index;
196
    }
197 9
198
    /**
199 9
     * @param string $batchPaymentId
200 9
     */
201
    public function setBatchPaymentId($batchPaymentId)
202
    {
203
        $this->batchPaymentId = trim($batchPaymentId);
204
    }
205
206
    /**
207
     * @return string
208
     */
209
    public function getBatchPaymentId()
210
    {
211
        return $this->batchPaymentId;
212
    }
213 1
214
    /**
215 1
     * @return string
216
     */
217
    public function getAdditionalInfo()
218
    {
219
        return $this->additionalInfo;
220
    }
221
222
    /**
223
     * @param string $additionalInfo
224
     */
225
    public function setAdditionalInfo($additionalInfo)
226
    {
227
        $this->additionalInfo = $additionalInfo;
228
    }
229
230
    /**
231
     * @return BankTransactionCode
232
     */
233
    public function getBankTransactionCode()
234
    {
235
        return $this->bankTransactionCode;
236
    }
237
238
    /**
239
     * @param BankTransactionCode $bankTransactionCode
240
     */
241
    public function setBankTransactionCode($bankTransactionCode)
242
    {
243
        $this->bankTransactionCode = $bankTransactionCode;
244
    }
245
}
246