From a39b4e2fbfdb11160203e0123eb2b3ca6f9625fa Mon Sep 17 00:00:00 2001 From: Tobias Matthaiou <225997+TumTum@users.noreply.github.com> Date: Thu, 14 Sep 2023 09:45:53 +0200 Subject: [PATCH] The function improves the code style by returning own object, to simplifying writing `(new \Ubench())->start()`. --- src/Ubench.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Ubench.php b/src/Ubench.php index a83ada6..474561a 100644 --- a/src/Ubench.php +++ b/src/Ubench.php @@ -33,11 +33,12 @@ class Ubench /** * Sets start microtime * - * @return void + * @return $this */ public function start() { $this->start_time = microtime(true); + return $this; } /** @@ -185,11 +186,17 @@ public static function readableElapsedTime($microtime, $format = null, $round = return sprintf($format, $time, $unit); } + /** + * @return bool + */ public function hasEnded() { return isset($this->end_time); } + /** + * @return bool + */ public function hasStarted() { return isset($this->start_time);