QueryAggregator::getCommand()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 1
crap 2
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