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

Section::addCommit()   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 1
crap 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