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

DocBlockComment   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 76.47%

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getAttitude() 0 3 1
A getName() 0 3 1
A getStatColor() 0 10 3
A getColor() 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 2
    public function getPattern(): string
10
    {
11 2
        return '/\/\*\*(?!.*\b(?:license|copyright|permission)\b).+?\*\//is';
12
    }
13
14 1
    public function getColor(): string
15
    {
16 1
        return 'green';
17
    }
18
19 1
    public function getStatColor(int $count, array $thresholds): string
20
    {
21 1
        if (! isset($thresholds[$this->getName()])) {
22 1
            return 'white';
23
        }
24
        if ($count >= $thresholds[$this->getName()]) {
25
            return 'green';
26
        }
27
        $this->exceedThreshold = true;
28
        return 'red';
29
    }
30
31 2
    public function getWeight(): float
32
    {
33 2
        return 1;
34
    }
35
36 2
    public function getAttitude(): string
37
    {
38 2
        return 'good';
39
    }
40
41 2
    public function getName(): string
42
    {
43 2
        return 'docBlock';
44
    }
45
}
46