LogFormatter::getLabel()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 7
cts 7
cp 1
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
crap 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 LogFormatter extends BenchmarkFormatter
9
{
10
    /**
11
     * @return string
12
     */
13 3
    public function getLabel()
14
    {
15 3
        $severity = $this->getMetadata()['severity'];
16 3
        return sprintf(
17 3
            '<span class="label %s">%s</span>',
18 3
            $this->getColorClass(),
19 3
            strtoupper($severity)
20 3
        );
21
    }
22
23
    /**
24
     * @return string
25
     */
26 6
    public function getColorClass()
27
    {
28 6
        $severity = $this->getMetadata()['severity'];
29 6
        return sprintf(
30 6
            'severity-%s',
31
            $severity
32 6
        );
33
    }
34
}
35