Completed
Push — master ( a5ff2b...bf9940 )
by Yann
05:35
created

Charges::setTotalChargesAndTaxAmount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
namespace Genkgo\Camt\DTO;
3
4
use Money\Money;
5
6
class Charges
7
{
8
    /** @var Money */
9
    private $totalChargesAndTaxAmount;
10
    
11
    /** @var ChargesRecords[] */
12
    private $records = [];
13
14
    /**
15
     * @return Money
16
     */
17
    public function getTotalChargesAndTaxAmount()
18
    {
19
        return $this->totalChargesAndTaxAmount;  
20
    }
21
22
    /**
23
     * @param Money $money
24
     */
25 4
    public function setTotalChargesAndTaxAmount(Money $money)
26
    {
27 4
        $this->totalChargesAndTaxAmount = $money;
28 4
    }
29
30
    /**
31
     * @param ChargesRecord $record
32
     */
33 4
    public function addRecord(ChargesRecord $record)
34
    {
35 4
        $this->records[] = $record;
36 4
    }
37
38
    /**
39
     * @return Records[]
40
     */
41
    public function getRecords()
42
    {
43
        return $this->records;
44
    }
45
46
    /**
47
     * @return ChargesRecord
48
     */
49
    public function getRecord()
50
    {
51
        if (isset($this->records[0])) {
52
            return $this->records[0];
53
        } else {
54
            throw new BadMethodCallException('There are no charges records at all for this entry');
55
        }
56
    }
57
}
58