Completed
Push — feature/fixing_cost ( ef981e )
by Laurent
01:53
created

Damage   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 51
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A fromArray() 0 6 1
A getAuthorName() 0 4 1
A getAmount() 0 4 1
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
     * @param string $authorName
22
     * @param float $amount
23
     */
24
    public function __construct($authorName, $amount)
25
    {
26
        $this->authorName = $authorName;
27
        $this->amount = $amount;
28
    }
29
30
    /**
31
     * @param array $properties
32
     *
33
     * @return Damage
34
     */
35
    public static function fromArray(array $properties){
36
        $author = $properties['author_name'];
37
        $amount = $properties['amount'];
38
39
        return new self($author, $amount);
40
    }
41
42
    /**
43
     * @return string
44
     */
45
    public function getAuthorName()
46
    {
47
        return $this->authorName;
48
    }
49
50
    /**
51
     * @return float
52
     */
53
    public function getAmount()
54
    {
55
        return $this->amount;
56
    }
57
}