BenchmarkFormatter   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 28
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A formatDuration() 0 4 1
A formatMemoryUsage() 0 4 1
A getMemoryUsage() 0 4 1
A getDuration() 0 4 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