Total Complexity | 4 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
21 | class Microtime |
||
22 | { |
||
23 | protected static float|null $frozenTime = null; |
||
24 | |||
25 | /** |
||
26 | * Freeze the microtime. |
||
27 | */ |
||
28 | public static function freeze(float|null $microtime = null): void |
||
29 | { |
||
30 | static::$frozenTime = $microtime ?? static::microtime(); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * Unfreeze the microtime. |
||
35 | */ |
||
36 | public static function unfreeze(): void |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Get the frozen, or unfrozen microtime. |
||
43 | */ |
||
44 | public static function get(): float |
||
45 | { |
||
46 | return static::$frozenTime ?? static::microtime(); |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * Get the microtime. |
||
51 | */ |
||
52 | protected static function microtime(): float |
||
55 | } |
||
56 | } |
||
57 |