Passed
Pull Request — master (#103)
by Andras
16:23
created

Entry   A

Complexity

Total Complexity 28

Size/Duplication

Total Lines 217
Duplicated Lines 0 %

Test Coverage

Coverage 72.31%

Importance

Changes 0
Metric Value
eloc 46
dl 0
loc 217
ccs 47
cts 65
cp 0.7231
rs 10
c 0
b 0
f 0
wmc 28

27 Methods

Rating   Name   Duplication   Size   Complexity  
A setBookingDate() 0 3 1
A getReversalIndicator() 0 3 1
A setAdditionalInfo() 0 3 1
A setBatchPaymentId() 0 3 1
A getAccountServicerReference() 0 3 1
A setReversalIndicator() 0 3 1
A setStatus() 0 3 1
A setCharges() 0 3 1
A getBookingDate() 0 3 1
A getTransactionDetails() 0 3 1
A getCharges() 0 3 1
A setAccountServicerReference() 0 3 1
A getBatchPaymentId() 0 3 1
A getAmount() 0 3 1
A setBankTransactionCode() 0 3 1
A getStatus() 0 3 1
A getIndex() 0 3 1
A __construct() 0 5 1
A getRecord() 0 3 1
A getValueDate() 0 3 1
A addTransactionDetail() 0 3 1
A getTransactionDetail() 0 7 2
A setReference() 0 3 1
A getReference() 0 3 1
A getAdditionalInfo() 0 3 1
A setValueDate() 0 3 1
A getBankTransactionCode() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Genkgo\Camt\DTO;
6
7
use DateTimeImmutable;
8
use Money\Money;
9
10
class Entry
11
{
12
    /**
13
     * @var Record
14
     */
15
    private $record;
16
17
    /**
18
     * @var Money
19
     */
20
    private $amount;
21
22
    /**
23
     * @var null|DateTimeImmutable
24
     */
25
    private $bookingDate;
26
27
    /**
28
     * @var null|DateTimeImmutable
29
     */
30
    private $valueDate;
31
32
    /**
33
     * @var EntryTransactionDetail[]
34
     */
35
    private $transactionDetails = [];
36
37
    /**
38
     * @var bool
39
     */
40
    private $reversalIndicator = false;
41
42
    /**
43
     * @var null|string
44
     */
45
    private $reference;
46
47
    /**
48
     * @var null|string
49
     */
50
    private $accountServicerReference;
51
52
    /**
53
     * @var int
54
     */
55
    private $index;
56
57
    /**
58
     * @var null|string
59
     */
60
    private $batchPaymentId;
61
62
    /**
63
     * @var null|string
64
     */
65
    private $additionalInfo;
66
67
    /**
68
     * @var null|BankTransactionCode
69
     */
70
    private $bankTransactionCode;
71
72
    /**
73
     * @var null|Charges
74
     */
75
    private $charges;
76
77 23
    /**
78
     * @var null|string
79 23
     */
80 23
    private $status;
81 23
82 23
    public function __construct(Record $record, int $index, Money $amount)
83
    {
84
        $this->record = $record;
85
        $this->index = $index;
86
        $this->amount = $amount;
87
    }
88
89 4
    public function getRecord(): Record
90
    {
91 4
        return $this->record;
92
    }
93
94 3
    public function getAmount(): Money
95
    {
96 3
        return $this->amount;
97
    }
98
99 3
    public function getBookingDate(): ?DateTimeImmutable
100
    {
101 3
        return $this->bookingDate;
102
    }
103
104 22
    public function getValueDate(): ?DateTimeImmutable
105
    {
106 22
        return $this->valueDate;
107 22
    }
108
109
    public function addTransactionDetail(EntryTransactionDetail $detail): void
110
    {
111
        $this->transactionDetails[] = $detail;
112 6
    }
113
114 6
    /**
115
     * @return EntryTransactionDetail[]
116
     */
117 2
    public function getTransactionDetails(): array
118
    {
119 2
        return $this->transactionDetails;
120 2
    }
121
122
    public function getTransactionDetail(): ?EntryTransactionDetail
123
    {
124
        if (isset($this->transactionDetails[0])) {
125
            return $this->transactionDetails[0];
126
        }
127
128
        return null;
129
    }
130
131 1
    public function getReversalIndicator(): bool
132
    {
133 1
        return $this->reversalIndicator;
134 1
    }
135
136
    public function setReversalIndicator(bool $reversalIndicator): void
137
    {
138
        $this->reversalIndicator = $reversalIndicator;
139
    }
140
141 1
    public function getReference(): ?string
142
    {
143 1
        return $this->reference;
144 1
    }
145
146
    public function setReference(?string $reference): void
147
    {
148
        $this->reference = $reference;
149
    }
150
151
    /**
152
     * Unique reference as assigned by the account servicing institution to unambiguously identify the entry.
153
     */
154 19
    public function getAccountServicerReference(): ?string
155
    {
156 19
        return $this->accountServicerReference;
157 19
    }
158
159
    public function setAccountServicerReference(?string $accountServicerReference): void
160
    {
161
        $this->accountServicerReference = $accountServicerReference;
162
    }
163
164 12
    public function getIndex(): int
165
    {
166 12
        return $this->index;
167 12
    }
168
169
    public function setBatchPaymentId(?string $batchPaymentId): void
170
    {
171
        $this->batchPaymentId = trim((string) $batchPaymentId);
172
    }
173
174 1
    public function getBatchPaymentId(): ?string
175
    {
176 1
        return $this->batchPaymentId;
177
    }
178
179 23
    public function getAdditionalInfo(): ?string
180
    {
181 23
        return $this->additionalInfo;
182 23
    }
183
184 2
    public function setAdditionalInfo(?string $additionalInfo): void
185
    {
186 2
        $this->additionalInfo = $additionalInfo;
187
    }
188
189 22
    public function getBankTransactionCode(): ?BankTransactionCode
190
    {
191 22
        return $this->bankTransactionCode;
192 22
    }
193
194
    public function setBankTransactionCode(?BankTransactionCode $bankTransactionCode): void
195
    {
196
        $this->bankTransactionCode = $bankTransactionCode;
197
    }
198
199
    public function getCharges(): ?Charges
200
    {
201
        return $this->charges;
202
    }
203
204 22
    public function setCharges(?Charges $charges): void
205
    {
206 22
        $this->charges = $charges;
207 22
    }
208
209 22
    public function setBookingDate(?DateTimeImmutable $date): void
210
    {
211 22
        $this->bookingDate = $date;
212 22
    }
213
214
    public function setValueDate(?DateTimeImmutable $date): void
215
    {
216
        $this->valueDate = $date;
217
    }
218
219
    public function getStatus(): ?string
220
    {
221
        return $this->status;
222
    }
223
224
    public function setStatus(?string $status): void
225
    {
226
        $this->status = $status;
227
    }
228
}
229