Total Complexity | 7 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
16 | class Timer { |
||
17 | |||
18 | private $startTime; |
||
19 | |||
20 | /** |
||
21 | * Inicia a contagem de tempo |
||
22 | */ |
||
23 | public function __construct() { |
||
24 | $this->startTime = microtime(true); |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * Reinicia a contagem de tempo |
||
29 | */ |
||
30 | public function reset() { |
||
31 | $this->startTime = microtime(true); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * Retorna o tempo gasto (em microsegundos) |
||
36 | * @return float |
||
37 | */ |
||
38 | private function getMicroTime() { |
||
39 | return microtime(true) - $this->startTime; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Retorna o tempo gasto (na unidade correta) |
||
44 | * @return string |
||
45 | */ |
||
46 | public function time() { |
||
62 | } |
||
63 | |||
64 | } |
||
65 |