X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FTestwork%2FCounter%2FTimer.php;fp=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FTestwork%2FCounter%2FTimer.php;h=0000000000000000000000000000000000000000;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=65025a33e281c89df4e88648bc69a0165f40d007;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;p=yaffs-website diff --git a/vendor/behat/behat/src/Behat/Testwork/Counter/Timer.php b/vendor/behat/behat/src/Behat/Testwork/Counter/Timer.php deleted file mode 100644 index 65025a33e..000000000 --- a/vendor/behat/behat/src/Behat/Testwork/Counter/Timer.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Counter; - -use Behat\Testwork\Counter\Exception\TimerException; - -/** - * Provides time counting functionality. - * - * @author Konstantin Kudryashov - */ -final class Timer -{ - /** - * @var null|float - */ - private $starTime; - /** - * @var null|float - */ - private $stopTime; - - /** - * Starts timer. - */ - public function start() - { - $this->starTime = microtime(true); - } - - /** - * Stops timer. - * - * @throws TimerException If timer has not been started - */ - public function stop() - { - if (!$this->starTime) { - throw new TimerException('You can not stop timer that has not been started.'); - } - - $this->stopTime = microtime(true); - } - - /** - * @return null|float - * - * @throws TimerException If timer has not been started - */ - public function getTime() - { - if (!$this->starTime) { - throw new TimerException('You can not get time from timer that never been started.'); - } - - $stopTime = $this->stopTime; - if (!$this->stopTime) { - $stopTime = microtime(true); - } - - return $stopTime - $this->starTime; - } - - /** - * Returns number of minutes passed. - * - * @return integer - */ - public function getMinutes() - { - return intval(floor($this->getTime() / 60)); - } - - /** - * Returns number of seconds passed. - * - * @return float - */ - public function getSeconds() - { - return round($this->getTime() - ($this->getMinutes() * 60), 3); - } - - /** - * Returns string representation of time passed. - * - * @return string - */ - public function __toString() - { - if (!$this->starTime || !$this->stopTime) { - return '0m0s'; - } - - return sprintf('%dm%.2fs', $this->getMinutes(), $this->getSeconds()); - } -}