1 | <?php |
||
5 | class TimeKeeper |
||
6 | { |
||
7 | const MINUTE = 60; |
||
8 | const HOUR = 3600; |
||
9 | const DAY = 86400; |
||
10 | |||
11 | /** |
||
12 | * @var float |
||
13 | */ |
||
14 | protected $startedAt; |
||
15 | |||
16 | /** |
||
17 | * @var float |
||
18 | */ |
||
19 | protected $finishedAt; |
||
20 | |||
21 | public function start() |
||
29 | |||
30 | public function stop() |
||
34 | |||
35 | /** |
||
36 | * @return float|null |
||
37 | */ |
||
38 | public function elapsed() |
||
46 | |||
47 | /** |
||
48 | * Format a duration into a human-readable time. |
||
49 | * |
||
50 | * @param float $duration |
||
51 | * Duration in seconds, with fractional component. |
||
52 | * |
||
53 | * @return string |
||
54 | */ |
||
55 | public static function formatDuration($duration) |
||
71 | } |
||
72 |