Completed
Pull Request — master (#31)
by
unknown
02:29
created

Entry::getBankTransactionCode()   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
     * @var BankTransactionCode
61
     */
62
    private $bankTransactionCode;
63
64
    /**
65
     * @param Record $record
66
     * @param int $index
67
     * @param Money $amount
68
     * @param DateTimeImmutable $bookingDate
69
     * @param DateTimeImmutable $valueDate
70
     */
71 18
    public function __construct(Record $record, $index, Money $amount, DateTimeImmutable $bookingDate, DateTimeImmutable $valueDate, $additionalInfo)
72
    {
73 18
        $this->record = $record;
74 18
        $this->index = $index;
75 18
        $this->amount = $amount;
76 18
        $this->bookingDate = $bookingDate;
77 18
        $this->valueDate = $valueDate;
78 18
        $this->additionalInfo = $additionalInfo;
79 18
    }
80
81
    /**
82
     * @return Record
83
     */
84
    public function getRecord()
85
    {
86
        return $this->record;
87
    }
88
89
    /**
90
     * @return Money
91
     */
92 4
    public function getAmount()
93
    {
94 4
        return $this->amount;
95
    }
96
97
    /**
98
     * @return DateTimeImmutable
99
     */
100 3
    public function getBookingDate()
101
    {
102 3
        return $this->bookingDate;
103
    }
104
105
    /**
106
     * @return DateTimeImmutable
107
     */
108 3
    public function getValueDate()
109
    {
110 3
        return $this->valueDate;
111
    }
112
113
    /**
114
     * @param EntryTransactionDetail $detail
115
     */
116 17
    public function addTransactionDetail(EntryTransactionDetail $detail)
117
    {
118 17
        $this->transactionDetails[] = $detail;
119 17
    }
120
121
    /**
122
     * @return EntryTransactionDetail[]
123
     */
124 3
    public function getTransactionDetails()
125
    {
126 3
        return $this->transactionDetails;
127
    }
128
129
    /**
130
     * @return EntryTransactionDetail
131
     */
132 1
    public function getTransactionDetail()
133
    {
134 1
        if (isset($this->transactionDetails[0])) {
135 1
            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
149
    /**
150
     * @param boolean $reversalIndicator
151
     */
152 1
    public function setReversalIndicator($reversalIndicator)
153
    {
154 1
        $this->reversalIndicator = $reversalIndicator;
155 1
    }
156
157
    /**
158
     * @return string
159
     */
160
    public function getReference()
161
    {
162
        return $this->reference;
163
    }
164
165
    /**
166
     * @param string $reference
167
     */
168 1
    public function setReference($reference)
169
    {
170 1
        $this->reference = $reference;
171 1
    }
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
182
    /**
183
     * @param string $accountServicerReference
184
     */
185 15
    public function setAccountServicerReference($accountServicerReference)
186
    {
187 15
        $this->accountServicerReference = $accountServicerReference;
188 15
    }
189
190
    /**
191
     * @return int
192
     */
193
    public function getIndex()
194
    {
195
        return $this->index;
196
    }
197
198
    /**
199
     * @param string $batchPaymentId
200
     */
201 8
    public function setBatchPaymentId($batchPaymentId)
202
    {
203 8
        $this->batchPaymentId = trim($batchPaymentId);
204 8
    }
205
206
    /**
207
     * @return string
208
     */
209
    public function getBatchPaymentId()
210
    {
211
        return $this->batchPaymentId;
212
    }
213
214
    /**
215
     * @return string
216
     */
217 1
    public function getAdditionalInfo()
218
    {
219 1
        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 1
    public function getBankTransactionCode()
234
    {
235 1
        return $this->bankTransactionCode;
236
    }
237
238
    /**
239
     * @param BankTransactionCode $bankTransactionCode
240
     */
241 17
    public function setBankTransactionCode($bankTransactionCode)
242
    {
243 17
        $this->bankTransactionCode = $bankTransactionCode;
244 17
    }
245
}
246