Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace NunoMaduro\Collision\Adapters\Phpunit;
6
 
7
/**
8
 * @internal
9
 */
10
final class Timer
11
{
12
    /**
13
     * @var float
14
     */
15
    private $start;
16
 
17
    /**
18
     * Timer constructor.
19
     */
20
    private function __construct(float $start)
21
    {
22
        $this->start = $start;
23
    }
24
 
25
    /**
26
     * Starts the timer.
27
     */
28
    public static function start(): Timer
29
    {
30
        return new self(microtime(true));
31
    }
32
 
33
    /**
34
     * Returns the elapsed time in microseconds.
35
     */
36
    public function result(): float
37
    {
38
        return microtime(true) - $this->start;
39
    }
40
}