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 |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
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 |