Passed
Push — master ( 1a8193...4ba352 )
by Alexander
02:01
created

Section   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 5
c 1
b 0
f 0
dl 0
loc 33
ccs 8
cts 8
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getCommits() 0 3 1
A addCommit() 0 3 1
A isEmpty() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Vasoft\VersionIncrement\Commits;
6
7
use Vasoft\VersionIncrement\Contract\SectionRuleInterface;
8
9
final class Section
10
{
11
    /** @var Commit[] */
12
    private array $commits = [];
13
14
    /**
15
     * @param SectionRuleInterface[] $rules
16
     */
17 16
    public function __construct(
18
        public readonly string $type,
19
        public readonly string $title,
20
        public readonly bool $hidden,
21
        public readonly array $rules,
22
        public readonly bool $isMajorMarker,
23
        public readonly bool $isMinorMarker,
24 16
    ) {}
25
26 15
    public function addCommit(Commit $commit): void
27
    {
28 15
        $this->commits[] = $commit;
29
    }
30
31
    /**
32
     * @return Commit[]
33
     */
34 15
    public function getCommits(): array
35
    {
36 15
        return $this->commits;
37
    }
38
39 15
    public function isEmpty(): bool
40
    {
41 15
        return empty($this->commits);
42
    }
43
}
44