Skip to content

Commit a035f36

Browse files
committed
Minor refactoring in Timer::stop()
1 parent 2e4f20b commit a035f36

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Timer.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,11 @@ private static function secondsToTimeString(float $time): string {
141141
* @throws \LogicException If the attempted timer has not started already.
142142
*/
143143
public static function stop($key = 'default'): void {
144-
if (isset(self::$timers[$key])) {
145-
self::$timers[$key]->stop();
146-
}
147-
else {
144+
if (!isset(self::$timers[$key])) {
148145
throw new \LogicException('Stopping timer when the given key timer was not initialized.');
149146
}
147+
148+
self::$timers[$key]->stop();
150149
}
151150

152151
/**

0 commit comments

Comments
 (0)