ConstraintViolation::getViolators()   A
last analyzed

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
declare(strict_types=1);
4
5
namespace Dominikb\ComposerLicenseChecker;
6
7
class ConstraintViolation
8
{
9
    /** @var string */
10
    protected $title;
11
12
    /** @var Dependency[] */
13
    protected $violators = [];
14
15 7
    public function __construct(string $title)
16
    {
17 7
        $this->title = $title;
18
    }
19
20 3
    public function add(Dependency $violator): void
21
    {
22 3
        $this->violators[] = $violator;
23
    }
24
25 1
    public function getTitle(): string
26
    {
27 1
        return $this->title;
28
    }
29
30
    /**
31
     * @return Dependency[]
32
     */
33 1
    public function getViolators(): array
34
    {
35 1
        return $this->violators;
36
    }
37
38 6
    public function hasViolators(): bool
39
    {
40 6
        return count($this->violators) > 0;
41
    }
42
}
43