Passed
Push — master ( 15f3d0...34d5bd )
by Adrien
01:53
created

Entry::setCreditDebitIndicator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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