Completed
Push — master ( 323b38...f8d35a )
by Magnar Ovedal
03:57
created

ValidationError::getMessage()   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 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stadly\PasswordPolice;
6
7
use Stadly\PasswordPolice\Rule\RuleInterface;
8
9
final class ValidationError
10
{
11
    /**
12
     * @var RuleInterface Rule that could not be validated.
13
     */
14
    private $rule;
15
16
    /**
17
     * @var int Weight of violated constraint.
18
     */
19
    private $weight;
20
21
    /**
22
     * @var string Message describing why the rule could not be validated.
23
     */
24
    private $message;
25
26
    /**
27
     * @param RuleInterface $rule Rule that could not be validated.
28
     * @param int $weight Weight of violated constraint.
29
     * @param string $message Message describing why the rule could not be validated.
30
     */
31 1
    public function __construct(RuleInterface $rule, int $weight, string $message)
32
    {
33 1
        $this->rule = $rule;
34 1
        $this->weight = $weight;
35 1
        $this->message = $message;
36 1
    }
37
38
    /**
39
     * @return RuleInterface Rule that could not be validated.
40
     */
41 1
    public function getRule(): RuleInterface
42
    {
43 1
        return $this->rule;
44
    }
45
46
    /**
47
     * @return int Weight of violated constraint.
48
     */
49 1
    public function getWeight(): int
50
    {
51 1
        return $this->weight;
52
    }
53
54
    /**
55
     * @return string Message describing why the rule could not be validated.
56
     */
57 1
    public function getMessage(): string
58
    {
59 1
        return $this->message;
60
    }
61
}
62