Passed
Push — main ( fcc13f...628042 )
by mikhail
02:55
created

FixMeComment::getStatColor()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 6
c 1
b 0
f 0
nc 3
nop 2
dl 0
loc 10
ccs 0
cts 7
cp 0
crap 12
rs 10
1
<?php
2
3
namespace SavinMikhail\CommentsDensity\Comments;
4
5
class FixMeComment extends Comment implements CommentTypeInterface
6
{
7 8
    public function getPattern(): string
8
    {
9 8
        return '/(?:\/\/|#|\/\*|\*|<!--).*?\bfixme\b.*/i';
10
    }
11
12
    public function getColor(): string
13
    {
14
        return 'yellow';
15
    }
16
17
    public function getStatColor(int $count, array $thresholds): string
18
    {
19
        if (! isset($thresholds[$this->getName()])) {
20
            return 'white';
21
        }
22
        if ($count <= $thresholds[$this->getName()]) {
23
            return 'green';
24
        }
25
        $this->exceedThreshold = true;
26
        return 'red';
27
    }
28
29 1
    public function getWeight(): float
30
    {
31 1
        return -0.3;
32
    }
33
34 1
    public function getAttitude(): string
35
    {
36 1
        return 'unwanted';
37
    }
38
39 2
    public function getName(): string
40
    {
41 2
        return 'fixme';
42
    }
43
}
44