Distance   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 6
c 1
b 0
f 0
dl 0
loc 28
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getFormattedValue() 0 3 1
A getValue() 0 3 1
A __toString() 0 3 1
1
<?php
2
3
namespace DH\NavigationBundle\Model;
4
5
use DH\NavigationBundle\Helper\FormatHelper;
6
7
class Distance
8
{
9
    /**
10
     * @var int
11
     */
12
    private $value;
13
14
    public function __construct(int $value)
15
    {
16
        $this->value = $value;
17
    }
18
19
    /**
20
     * @param int
21
     */
22
    public function getFormattedValue(int $precision = 1): string
23
    {
24
        return FormatHelper::formatDistance($this->value, $precision);
25
    }
26
27
    public function getValue(): int
28
    {
29
        return $this->value;
30
    }
31
32
    public function __toString(): string
33
    {
34
        return $this->getFormattedValue();
35
    }
36
}
37