Microtime   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A compare() 0 6 1
A untilNow() 0 6 1
1
<?php
2
3
/**
4
 * Contains some tools to work with performance timing
5
 *
6
 * PHP Version 5
7
 *
8
 * @category  Core
9
 * @package   Date
10
 * @author    Hans-Joachim Piepereit <[email protected]>
11
 * @copyright 2013 cSphere Team
12
 * @license   http://opensource.org/licenses/bsd-license Simplified BSD License
13
 * @link      http://www.csphere.eu
14
 **/
15
16
namespace csphere\core\date;
17
18
/**
19
 * Class for microtime operations
20
 *
21
 * @category  Core
22
 * @package   Date
23
 * @author    Hans-Joachim Piepereit <[email protected]>
24
 * @copyright 2013 cSphere Team
25
 * @license   http://opensource.org/licenses/bsd-license Simplified BSD License
26
 * @link      http://www.csphere.eu
27
 **/
28
29
class Microtime
30
{
31
32
    /**
33
     * Microtime comparison
34
     *
35
     * @param float $mt_start Microtime start point
36
     * @param float $mt_end   Microtime end point
37
     *
38
     * @return int
39
     **/
0 ignored issues
show
Coding Style introduced by
There must be no blank lines after the function comment
Loading history...
40
41
    public static function compare($mt_start, $mt_end)
42
    {
43
        $parsetime = round(($mt_end - $mt_start) * 1000);
44
45
        return (int)$parsetime;
46
    }
47
48
    /**
49
     * Parsetime calculation
50
     *
51
     * @param float $microtime Microtime
52
     *
53
     * @return int
54
     **/
0 ignored issues
show
Coding Style introduced by
There must be no blank lines after the function comment
Loading history...
55
56
    public static function untilNow($microtime)
57
    {
58
        $mt_now = microtime(true);
59
60
        return self::compare($microtime, $mt_now);
61
    }
62
}
63