Passed
Push — main ( 28fe2f...804823 )
by mikhail
03:26
created

DocBlockComment::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
declare(strict_types=1);
4
5
namespace SavinMikhail\CommentsDensity\Comments;
6
7
final class DocBlockComment extends Comment implements CommentTypeInterface
8
{
9 1
    public function getPattern(): string
10
    {
11 1
        return '/\/\*\*(?!.*\b(?:license|copyright|permission)\b).+?\*\//is';
12
    }
13
14
    public function getColor(): string
15
    {
16
        return 'green';
17
    }
18
19
    public function getStatColor(int $count, array $thresholds): string
20
    {
21
        if (! isset($thresholds[$this->getName()])) {
22
            return 'white';
23
        }
24
        if ($count >= $thresholds[$this->getName()]) {
25
            return 'green';
26
        }
27
        $this->exceedThreshold = true;
28
        return 'red';
29
    }
30
31 1
    public function getWeight(): float
32
    {
33 1
        return 1;
34
    }
35
36 1
    public function getAttitude(): string
37
    {
38 1
        return 'good';
39
    }
40
41 1
    public function getName(): string
42
    {
43 1
        return 'docBlock';
44
    }
45
}
46