Duration::__toString()   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;
4
5
use DH\NavigationBundle\Helper\FormatHelper;
6
7
class Duration
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::formatTime($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