Stopwatch::start()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace Workana\AsyncJobs;
3
4
/**
5
 * Stopwatch
6
 */
7
class Stopwatch
8
{
9
    /**
10
     * @var float
11
     */
12
    private $startTime = null;
13
14
    /**
15
     * Start (or restart)
16
     *
17
     * @return void
18
     */
19
    public function start()
20
    {
21
        $this->startTime = microtime(true);
22
    }
23
24
    /**
25
     * Get elapsed time (in seconds)
26
     *
27
     * @return float
28
     */
29
    public function elapsed()
30
    {
31
        return microtime(true) - $this->startTime;
32
    }
33
}