Skip to content

Commit e56d5be

Browse files
committed
Minor refactoring and code cleanup
1 parent a035f36 commit e56d5be

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Stopwatch.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function read(): float {
3333
if ($this->running) {
3434
return $this->accrued + ($this->getTimestamp() - $this->timestamp);
3535
}
36+
3637
return $this->accrued;
3738
}
3839

src/Timer.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ class Timer {
5050
public static function start(string $key = 'default'): void {
5151
if (isset(self::$timers[$key])) {
5252
self::$timers[$key]->start();
53+
return;
5354
}
54-
else {
55-
self::$timers[$key] = new Stopwatch();
56-
}
55+
56+
self::$timers[$key] = new Stopwatch();
5757
}
5858

5959
/**
@@ -92,6 +92,7 @@ public static function read(string $key = 'default', $format = self::FORMAT_MILL
9292
if (isset(self::$timers[$key])) {
9393
return self::formatTime(self::$timers[$key]->read(), $format);
9494
}
95+
9596
throw new \LogicException('Reading timer when the given key timer was not initialized.');
9697
}
9798

0 commit comments

Comments
 (0)