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

DocBlockComment   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 47.06%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 37
ccs 8
cts 17
cp 0.4706
rs 10
wmc 8

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getStatColor() 0 10 3
A getColor() 0 3 1
A getAttitude() 0 3 1
A getName() 0 3 1
A getWeight() 0 3 1
A getPattern() 0 3 1
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