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

FlightDamage   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 78
rs 10
c 0
b 0
f 0
wmc 6
lcom 0
cbo 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A damage() 0 3 1
A isBilled() 0 4 1
A getFlightId() 0 3 1
A amount() 0 3 1
A getAuthor() 0 4 1
1
<?php
2
3
4
namespace FlightLog\Domain\Damage;
5
6
final class FlightDamage
7
{
8
    /**
9
     * @var FlightId
10
     */
11
    private $flight;
12
13
    /**
14
     * @var DamageAmount
15
     */
16
    private $amount;
17
18
    /**
19
     * @var bool
20
     */
21
    private $billed;
22
23
    /**
24
     * @var AuthorId
25
     */
26
    private $author;
27
28
    /**
29
     * @param FlightId $flightId
30
     * @param DamageAmount $amount
31
     * @param $billed
32
     * @param AuthorId $authorId
33
     */
34
    private function __construct(FlightId $flightId, DamageAmount $amount, $billed, AuthorId $authorId)
35
    {
36
       $this->flight = $flightId;
37
       $this->amount = $amount;
38
       $this->billed = $billed;
39
       $this->author = $authorId;
40
    }
41
42
    /**
43
     * @param FlightId $flightId
44
     * @param DamageAmount $amount
45
     * @param AuthorId $authorId
46
     *
47
     * @return FlightDamage
48
     */
49
    public static function damage(FlightId $flightId, DamageAmount $amount, AuthorId $authorId){
50
        return new self($flightId, $amount, false, $authorId);
51
    }
52
53
    /**
54
     * @return bool
55
     */
56
    public function isBilled()
57
    {
58
        return $this->billed;
59
    }
60
61
    /**
62
     * @return FlightId
63
     */
64
    public function getFlightId(){
65
        return $this->flight;
66
    }
67
68
    /**
69
     * @return DamageAmount
70
     */
71
    public function amount(){
72
        return $this->amount;
73
    }
74
75
    /**
76
     * @return AuthorId
77
     */
78
    public function getAuthor()
79
    {
80
        return $this->author;
81
    }
82
83
}