Passed
Push — master ( 42ec06...5ff168 )
by Alec
09:14
created

Timer::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 2
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace AlecRabbit\Timers;
4
5
use AlecRabbit\Formatters\TimerReportFormatter;
6
use AlecRabbit\Reports\TimerReport;
7
use AlecRabbit\Timers\Core\AbstractTimer;
8
9
/**
10
 * Class Timer
11
 * @package AlecRabbit\Timers
12
 */
13
class Timer extends AbstractTimer
14
{
15 19
    public function __construct(?string $name = null, bool $start = true)
16
    {
17 19
        parent::__construct($name, $start);
18 19
        $this->setBindings(
19 19
            TimerReport::class,
20 19
            TimerReportFormatter::class
21
        );
22 19
    }
23
24
25
    /**
26
     * @return float
27
     */
28 16
    public function current(): float
29
    {
30
        return
31 16
            microtime(true);
32
    }
33
34
    /**
35
     * @param float $start
36
     * @param float $stop
37
     */
38 4
    protected function assertStartAndStop($start, $stop): void
39
    {
40 4
        $this->assertStart($start);
41 3
        $this->assertStop($stop);
42 2
    }
43
44
    /**
45
     * @param float $start
46
     */
47 3
    protected function assertStart(/** @scrutinizer ignore-unused */ float $start): void
48
    {
49
        // Intentionally left blank
50 3
    }
51
52
    /**
53
     * @param float $stop
54
     */
55 2
    protected function assertStop(/** @scrutinizer ignore-unused */ float $stop): void
56
    {
57
        // Intentionally left blank
58 2
    }
59
}
60