BenchmarkFormatter::formatDuration()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * @author @fabfuel <[email protected]>
4
 * @created 17.11.14, 07:45 
5
 */
6
namespace Fabfuel\Prophiler\Toolbar\Formatter;
7
8
class BenchmarkFormatter extends BenchmarkFormatterAbstract implements BenchmarkFormatterInterface
9
{
10 1
    public static function formatDuration($duration)
11
    {
12 1
        return sprintf('%.2f ms', $duration);
13
    }
14
15 1
    public static function formatMemoryUsage($memoryUsage)
16
    {
17 1
        return sprintf('%.3f MB', ($memoryUsage /1024 /1024 ));
18
    }
19
20
    /**
21
     * @return string
22
     */
23 1
    public function getMemoryUsage()
24
    {
25 1
        return sprintf('%.3f MB', ($this->getBenchmark()->getMemoryUsage() /1024 /1024 ));
26
    }
27
28
    /**
29
     * @return string
30
     */
31 1
    public function getDuration()
32
    {
33 1
        return sprintf('%.2f ms', $this->getBenchmark()->getDuration());
34
    }
35
}
36