@@ -40,6 +40,9 @@ |
||
| 40 | 40 | static::$timers = []; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | + /** |
|
| 44 | + * @param string $format |
|
| 45 | + */ |
|
| 43 | 46 | final static protected function processTimerValue($value, $format) { |
| 44 | 47 | if ($value[0]) { |
| 45 | 48 | return static::formatTime((static::getCurrentTime() - $value[1]) + $value[2], $format); |
@@ -16,14 +16,12 @@ discard block |
||
| 16 | 16 | static public function start($key = 'default') { |
| 17 | 17 | if (!is_scalar($key)) { |
| 18 | 18 | throw new \InvalidArgumentException('Key should be a scalar value.'); |
| 19 | - } |
|
| 20 | - elseif (isset(static::$timers[$key])) { |
|
| 19 | + } elseif (isset(static::$timers[$key])) { |
|
| 21 | 20 | if (empty(static::$timers[$key][0])) { |
| 22 | 21 | static::$timers[$key][0] = true; |
| 23 | 22 | static::$timers[$key][1] = static::getCurrentTime(); |
| 24 | 23 | } |
| 25 | - } |
|
| 26 | - else { |
|
| 24 | + } else { |
|
| 27 | 25 | static::$timers[$key] = [ |
| 28 | 26 | true, |
| 29 | 27 | static::getCurrentTime(), |
@@ -43,8 +41,7 @@ discard block |
||
| 43 | 41 | final static protected function processTimerValue($value, $format) { |
| 44 | 42 | if ($value[0]) { |
| 45 | 43 | return static::formatTime((static::getCurrentTime() - $value[1]) + $value[2], $format); |
| 46 | - } |
|
| 47 | - else { |
|
| 44 | + } else { |
|
| 48 | 45 | return static::formatTime($value[2], $format); |
| 49 | 46 | } |
| 50 | 47 | } |
@@ -78,8 +75,7 @@ discard block |
||
| 78 | 75 | $ct = static::getCurrentTime(); |
| 79 | 76 | static::$timers[$key][0] = false; |
| 80 | 77 | static::$timers[$key][2] = static::$timers[$key][2] + ($ct - static::$timers[$key][1]); |
| 81 | - } |
|
| 82 | - else { |
|
| 78 | + } else { |
|
| 83 | 79 | throw new \LogicException('Stopping timer when the given key timer was not initialized.'); |
| 84 | 80 | } |
| 85 | 81 | } |