| 1 | <?php |
||
| 17 | class Time |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * Time formatting helper |
||
| 21 | * |
||
| 22 | * @var array |
||
| 23 | */ |
||
| 24 | private static $times = [ |
||
| 25 | 'hour' => 3600, |
||
| 26 | 'minute' => 60, |
||
| 27 | 'second' => 1 |
||
| 28 | ]; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Returns the time passed since execution start. |
||
| 32 | * |
||
| 33 | * @throws \RuntimeException |
||
| 34 | */ |
||
| 35 | 13 | public static function timeSinceExecutionStart() : float |
|
| 46 | |||
| 47 | /** |
||
| 48 | * Return string like '1 hour 3 minutes 12 seconds'. |
||
| 49 | * |
||
| 50 | * @param float $time |
||
| 51 | * @return string |
||
| 52 | */ |
||
| 53 | 11 | public static function formatTime(float $time) : string |
|
| 66 | } |
||
| 67 |