QueryAggregator   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A accept() 0 4 1
A getCommand() 0 4 2
A getTitle() 0 4 1
A getIcon() 0 4 1
1
<?php
2
/**
3
 * @author @fabfuel <[email protected]>
4
 * @created: 23.04.15 17:47
5
 */
6
7
namespace Fabfuel\Prophiler\Aggregator\Database;
8
9
use Fabfuel\Prophiler\Aggregator\AbstractAggregator;
10
use Fabfuel\Prophiler\Benchmark\BenchmarkInterface;
11
12
/**
13
 * Class QueryAggregator
14
 * @package Fabfuel\Prophiler\Aggregator\Database
15
 */
16
class QueryAggregator extends AbstractAggregator
17
{
18
    /**
19
     * @param BenchmarkInterface $benchmark
20
     * @return bool
21
     */
22 1
    public function accept(BenchmarkInterface $benchmark)
23
    {
24 1
        return $benchmark->getComponent() === 'Database';
25
    }
26
27
    /**
28
     * @param BenchmarkInterface $benchmark
29
     * @return string
30
     */
31 2
    public function getCommand(BenchmarkInterface $benchmark)
32
    {
33 2
        return $benchmark->getMetadataValue('query') ?: $benchmark->getName();
34
    }
35
36
    /**
37
     * Get the title of this data collector
38
     *
39
     * @return string
40
     */
41 1
    public function getTitle()
42
    {
43 1
        return 'Queries';
44
    }
45
46
    /**
47
     * Get the font-awesome icon class (e.g. fa-pie-chart)
48
     * http://fortawesome.github.io/Font-Awesome/icons/
49
     *
50
     * @return string
51
     */
52 1
    public function getIcon()
53
    {
54 1
        return '<i class="fa fa-database"></i>';
55
    }
56
}
57