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

TotalDamage   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A fromArray() 0 4 1
A getTotalAmount() 0 4 1
A getAuthorId() 0 4 1
1
<?php
2
3
4
namespace FlightLog\Application\Damage\ViewModel;
5
6
7
use FlightLog\Application\Common\ViewModel\ViewModel;
8
9
final class TotalDamage extends ViewModel
10
{
11
12
    /**
13
     * @var float
14
     */
15
    private $totalAmount;
16
17
    /**
18
     * @var int
19
     */
20
    private $authorId;
21
22
    /**
23
     * @param float $totalAmount
24
     * @param int $authorId
25
     */
26
    public function __construct($totalAmount, $authorId)
27
    {
28
        $this->totalAmount = $totalAmount;
29
        $this->authorId = $authorId;
30
    }
31
32
    /**
33
     * @param array $values
34
     *
35
     * @return mixed
36
     */
37
    public static function fromArray(array $values)
38
    {
39
        return new self($values['total_amount'], $values['author']);
40
    }
41
42
    /**
43
     * @return float
44
     */
45
    public function getTotalAmount()
46
    {
47
        return $this->totalAmount;
48
    }
49
50
    /**
51
     * @return int
52
     */
53
    public function getAuthorId()
54
    {
55
        return $this->authorId;
56
    }
57
58
59
}