Passed
Push — master ( 5c8f34...432941 )
by Mr
01:54
created

ValidationIncident::getValidatorDefinition()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of the daikon-cqrs/validize project.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Daikon\Validize\Validation;
10
11
use Daikon\Validize\ValueObject\Severity;
12
13
final class ValidationIncident
14
{
15
    private ValidatorDefinition $validatorDefinition;
16
17
    private Severity $severity;
18
19
    /** @var string[] */
20
    private array $messages = [];
21
22
    public function __construct(ValidatorDefinition $validatorDefinition, Severity $severity)
23
    {
24
        $this->validatorDefinition = $validatorDefinition;
25
        $this->severity = $severity;
26
    }
27
28
    public function addMessage(string $message): self
29
    {
30
        $this->messages[] = $message;
31
        return $this;
32
    }
33
34
    public function getValidatorDefinition(): ValidatorDefinition
35
    {
36
        return $this->validatorDefinition;
37
    }
38
39
    public function getSeverity(): Severity
40
    {
41
        return $this->severity;
42
    }
43
44
    public function getMessages(): array
45
    {
46
        return $this->messages;
47
    }
48
}
49