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

Charges   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 42.86%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 52
ccs 6
cts 14
cp 0.4286
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getTotalChargesAndTaxAmount() 0 4 1
A setTotalChargesAndTaxAmount() 0 4 1
A addRecord() 0 4 1
A getRecords() 0 4 1
A getRecord() 0 8 2
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