Passed
Push — master ( 5361e0...296be2 )
by Damien
02:19
created

Step::getInstruction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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 Step
9
{
10
    /**
11
     * @var array
12
     */
13
    private $position;
14
15
    /**
16
     * @var Distance
17
     */
18
    private $distance;
19
20
    /**
21
     * @var Duration
22
     */
23
    private $duration;
24
25
    /**
26
     * @var string
27
     */
28
    private $instruction;
29
30
    public function __construct(array $data)
31
    {
32
        $this->position = $data['position'] ?? [];
33
        $this->instruction = $data['instruction'] ?? '';
34
        $this->duration = new Duration((int) ($data['instruction'] ?? 0));
35
        $this->distance = new Distance((int) ($data['distance'] ?? 0));
36
    }
37
38
    /**
39
     * Get the value of position.
40
     *
41
     * @return array
42
     */
43
    public function getPosition(): array
44
    {
45
        return $this->position;
46
    }
47
48
    /**
49
     * Get the value of distance.
50
     *
51
     * @return Distance
52
     */
53
    public function getDistance(): Distance
54
    {
55
        return $this->distance;
56
    }
57
58
    /**
59
     * Get the value of duration.
60
     *
61
     * @return Duration
62
     */
63
    public function getDuration(): Duration
64
    {
65
        return $this->duration;
66
    }
67
68
    /**
69
     * Get the value of instruction.
70
     *
71
     * @return string
72
     */
73
    public function getInstruction(): string
74
    {
75
        return $this->instruction;
76
    }
77
}
78