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

ValidationIncident   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 34
ccs 0
cts 21
cp 0
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getSeverity() 0 3 1
A getMessages() 0 3 1
A __construct() 0 4 1
A addMessage() 0 4 1
A getValidatorDefinition() 0 3 1
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