Completed
Push — feature/fixing_cost ( 2c76a0...f58af6 )
by Laurent
01:38
created

Damage::isInvoiced()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace FlightLog\Application\Damage\ViewModel;
5
6
7
final class Damage
8
{
9
10
    /**
11
     * @var string
12
     */
13
    private $authorName;
14
15
    /**
16
     * @var float
17
     */
18
    private $amount;
19
20
    /**
21
     * @var int
22
     */
23
    private $id;
24
25
    /**
26
     * @var bool
27
     */
28
    private $invoiced;
29
30
    /**
31
     * @param string $authorName
32
     * @param float $amount
33
     * @param int $id
34
     * @param bool $invoiced
35
     */
36
    public function __construct($authorName, $amount, $id, $invoiced)
37
    {
38
        $this->authorName = $authorName;
39
        $this->amount = $amount;
40
        $this->id = $id;
41
        $this->invoiced = $invoiced;
42
    }
43
44
    /**
45
     * @param array $properties
46
     *
47
     * @return Damage
48
     */
49
    public static function fromArray(array $properties){
50
        $author = $properties['author_name'];
51
        $amount = $properties['amount'];
52
        $id = $properties['id'];
53
        $invoiced = (bool)$properties['invoiced'];
54
55
        return new self($author, $amount, $id, $invoiced);
56
    }
57
58
    /**
59
     * @return string
60
     */
61
    public function getAuthorName()
62
    {
63
        return $this->authorName;
64
    }
65
66
    /**
67
     * @return float
68
     */
69
    public function getAmount()
70
    {
71
        return $this->amount;
72
    }
73
74
    /**
75
     * @return int
76
     */
77
    public function getId()
78
    {
79
        return $this->id;
80
    }
81
82
    /**
83
     * @return bool
84
     */
85
    public function isInvoiced()
86
    {
87
        return $this->invoiced;
88
    }
89
}