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

LicenseComment::getPattern()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace SavinMikhail\CommentsDensity\Comments;
4
5
class LicenseComment extends Comment implements CommentTypeInterface
6
{
7 3
    public function getPattern(): string
8
    {
9 3
        return '/\/\*\*.*?\b(?:license|copyright|permission)\b.*?\*\//is';
10
    }
11
12
    public function getColor(): string
13
    {
14
        return 'white';
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;
32
    }
33
34 1
    public function getAttitude(): string
35
    {
36 1
        return 'neutral';
37
    }
38
39 2
    public function getName(): string
40
    {
41 2
        return 'license';
42
    }
43
}
44