MissRate::getKpi()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 * Miss rate
4
 *
5
 * @package CacheCheck\Service\Analyzer
6
 * @author  Tim Lochmüller
7
 */
8
9
namespace HDNET\CacheCheck\Service\Analyzer;
10
11
use HDNET\CacheCheck\Domain\Model\Cache;
12
13
/**
14
 * Miss rate
15
 *
16
 * @author Tim Lochmüller
17
 */
18
class MissRate extends AbstractAnalyzer
19
{
20
21
    /**
22
     * Get the given KPI
23
     *
24
     * @param Cache $cache
25
     *
26
     * @return mixed
27
     * @throws \HDNET\CacheCheck\Exception
28
     */
29
    public function getKpi(Cache $cache)
30
    {
31
        $hitRate = $this->getAnalyzer('HitRate');
32
        return 1 - $hitRate->getKpi($cache);
33
    }
34
35
    /**
36
     * Format the given KPI
37
     *
38
     * @param mixed $kpi
39
     *
40
     * @return string
41
     */
42
    public function getFormat($kpi)
43
    {
44
        return round($kpi * 100, 2) . '%';
45
    }
46
}
47