FlightTypeCount::getType()   A
last analyzed

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
require_once(DOL_DOCUMENT_ROOT . '/flightlog/class/billing/FlightCost.php');
4
5
/**
6
 * @author Laurent De Coninck <[email protected]>
7
 */
8
class FlightTypeCount
9
{
10
11
    /**
12
     * @var string
13
     */
14
    private $type;
15
16
    /**
17
     * @var int
18
     */
19
    private $count;
20
21
    /**
22
     * @var int
23
     */
24
    private $factor;
25
26
    /**
27
     * @param string $type
28
     * @param int    $count
29
     * @param int    $factor
30
     */
31
    public function __construct($type, $count = 0, $factor = 0)
32
    {
33
        $this->type = $type;
34
        $this->count = (int) $count;
35
        $this->factor = (int) $factor;
36
    }
37
38
    /**
39
     * @return string
40
     */
41
    public function getType()
42
    {
43
        return $this->type;
44
    }
45
46
    /**
47
     * @return int
48
     */
49
    public function getCount()
50
    {
51
        return $this->count;
52
    }
53
54
    /**
55
     * @return int
56
     */
57
    public function getFactor()
58
    {
59
        return $this->factor;
60
    }
61
62
    /**
63
     * @param FlightTypeCount $flightTypeCount
64
     *
65
     * @return FlightTypeCount
66
     */
67
    public function add(FlightTypeCount $flightTypeCount)
68
    {
69
        return new FlightTypeCount($this->type, $this->count + $flightTypeCount->getCount(), $this->factor);
70
    }
71
72
    /**
73
     * @return FlightCost
74
     */
75
    public function getCost()
76
    {
77
        return new FlightCost($this->count * $this->factor);
78
    }
79
}