Completed
Push — master ( aabf4d...606f02 )
by Frederik
9s
created

Balance   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 81
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 86.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 81
ccs 13
cts 15
cp 0.8667
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getDate() 0 4 1
A getAmount() 0 4 1
A getType() 0 4 1
A opening() 0 4 1
A closing() 0 4 1
1
<?php
2
3
namespace Genkgo\Camt\Camt053\DTO;
4
5
use DateTimeImmutable;
6
use Money\Money;
7
8
/**
9
 * Class Balance
10
 * @package Genkgo\Camt\Camt053
11
 */
12
class Balance
13
{
14
    /**
15
     *
16
     */
17
    const TYPE_OPENING = 'opening';
18
    /**
19
     *
20
     */
21
    const TYPE_CLOSING = 'closing';
22
23
    /**
24
     * @var Money
25
     */
26
    private $amount;
27
    /**
28
     * @var string
29
     */
30
    private $type;
31
32
    /**
33
     * @var DateTimeImmutable
34
     */
35
    private $date;
36
37
    /**
38
     * @param $type
39
     * @param Money $amount
40
     * @param DateTimeImmutable $date
41
     */
42 10
    private function __construct($type, Money $amount, DateTimeImmutable $date)
43
    {
44 10
        $this->type = $type;
45 10
        $this->amount = $amount;
46 10
        $this->date = $date;
47 10
    }
48
49
    /**
50
     * @return DateTimeImmutable
51
     */
52
    public function getDate()
53
    {
54
        return $this->date;
55
    }
56
57
    /**
58
     * @return Money
59
     */
60 1
    public function getAmount()
61
    {
62 1
        return $this->amount;
63
    }
64
65
    /**
66
     * @return string
67
     */
68 1
    public function getType()
69
    {
70 1
        return $this->type;
71
    }
72
73
    /**
74
     * @param Money $amount
75
     * @param DateTimeImmutable $date
76
     * @return static
77
     */
78 10
    public static function opening(Money $amount, DateTimeImmutable $date)
79
    {
80 10
        return new static (self::TYPE_OPENING, $amount, $date);
81
    }
82
83
    /**
84
     * @param Money $amount
85
     * @param DateTimeImmutable $date
86
     * @return static
87
     */
88 9
    public static function closing(Money $amount, DateTimeImmutable $date)
89
    {
90 9
        return new static (self::TYPE_CLOSING, $amount, $date);
91
    }
92
}
93