Summary::getTrafficTime()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace DH\NavigationBundle\Model\Routing;
4
5
use DH\NavigationBundle\Model\Distance;
6
use DH\NavigationBundle\Model\Duration;
7
8
class Summary
9
{
10
    /**
11
     * @var Distance
12
     */
13
    private $distance;
14
15
    /**
16
     * @var Duration
17
     */
18
    private $trafficTime;
19
20
    /**
21
     * @var Duration
22
     */
23
    private $baseTime;
24
25
    /**
26
     * @var Duration
27
     */
28
    private $travelTime;
29
30
    /**
31
     * @var string
32
     */
33
    private $text;
34
35
    /**
36
     * @var array
37
     */
38
    private $flags;
39
40
    public function __construct(array $data)
41
    {
42
        $this->distance = new Distance($data['distance'] ?? 0);
43
        $this->trafficTime = new Duration($data['trafficTime'] ?? 0);
44
        $this->baseTime = new Duration($data['baseTime'] ?? 0);
45
        $this->travelTime = new Duration($data['travelTime'] ?? 0);
46
        $this->text = $data['text'] ?? null;
47
        $this->flags = $data['flags'] ?? [];
48
    }
49
50
    /**
51
     * Get the value of distance.
52
     */
53
    public function getDistance(): Distance
54
    {
55
        return $this->distance;
56
    }
57
58
    /**
59
     * Get the value of trafficTime.
60
     */
61
    public function getTrafficTime(): Duration
62
    {
63
        return $this->trafficTime;
64
    }
65
66
    /**
67
     * Get the value of baseTime.
68
     */
69
    public function getBaseTime(): Duration
70
    {
71
        return $this->baseTime;
72
    }
73
74
    /**
75
     * Get the value of travelTime.
76
     */
77
    public function getTravelTime(): Duration
78
    {
79
        return $this->travelTime;
80
    }
81
82
    /**
83
     * Get the value of text.
84
     */
85
    public function getText(): string
86
    {
87
        return $this->text;
88
    }
89
90
    /**
91
     * Get the value of flags.
92
     */
93
    public function getFlags(): array
94
    {
95
        return $this->flags;
96
    }
97
}
98