Charges::addRecord()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Genkgo\Camt\DTO;
6
7
use Money\Money;
8
9
class Charges
10
{
11
    private ?Money $totalChargesAndTaxAmount = null;
12
13
    /**
14
     * @var ChargesRecord[]
15
     */
16
    private array $records = [];
17
18
    public function getTotalChargesAndTaxAmount(): ?Money
19
    {
20
        return $this->totalChargesAndTaxAmount;
21
    }
22
23
    public function setTotalChargesAndTaxAmount(Money $money): void
24
    {
25
        $this->totalChargesAndTaxAmount = $money;
26 4
    }
27
28 4
    public function addRecord(ChargesRecord $record): void
29 4
    {
30
        $this->records[] = $record;
31 4
    }
32
33 4
    /**
34 4
     * @return ChargesRecord[]
35
     */
36
    public function getRecords(): array
37
    {
38
        return $this->records;
39
    }
40
41
    public function getRecord(): ?ChargesRecord
42
    {
43
        if (isset($this->records[0])) {
44
            return $this->records[0];
45
        }
46
47
        return null;
48
    }
49
}
50