EndTime   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 0
cbo 4
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getKpi() 0 9 2
1
<?php
2
/**
3
 * End time
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
use HDNET\CacheCheck\Exception;
13
14
/**
15
 * End time
16
 *
17
 * @author Tim Lochmüller
18
 */
19
class EndTime extends StartTime
20
{
21
22
    /**
23
     * Get the given KPI
24
     *
25
     * @param Cache $cache
26
     *
27
     * @return mixed
28
     * @throws \HDNET\CacheCheck\Exception
29
     */
30
    public function getKpi(Cache $cache)
31
    {
32
        $startTime = $this->getDatabaseConnection()
33
            ->exec_SELECTgetSingleRow('timestamp', 'tx_cachecheck_domain_model_log', 'cache_name = "' . $cache->getName() . '"', '', 'timestamp DESC');
34
        if (!isset($startTime['timestamp'])) {
35
            throw new Exception('No start time found', 1236723844);
36
        }
37
        return (int)($startTime['timestamp'] / 1000);
38
    }
39
}
40