Step   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 13
c 1
b 0
f 0
dl 0
loc 60
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getPosition() 0 3 1
A getDistance() 0 3 1
A getDuration() 0 3 1
A getInstruction() 0 3 1
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['duration'] ?? 0));
35
        $this->distance = new Distance((int) ($data['distance'] ?? 0));
36
    }
37
38
    /**
39
     * Get the value of position.
40
     */
41
    public function getPosition(): array
42
    {
43
        return $this->position;
44
    }
45
46
    /**
47
     * Get the value of distance.
48
     */
49
    public function getDistance(): Distance
50
    {
51
        return $this->distance;
52
    }
53
54
    /**
55
     * Get the value of duration.
56
     */
57
    public function getDuration(): Duration
58
    {
59
        return $this->duration;
60
    }
61
62
    /**
63
     * Get the value of instruction.
64
     */
65
    public function getInstruction(): string
66
    {
67
        return $this->instruction;
68
    }
69
}
70