Stopwatch   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A start() 0 4 1
A elapsed() 0 4 1
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
}