Passed
Push — main ( b4697e...9f091b )
by Breno
01:42
created

AnError::rule()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace BrenoRoosevelt\Validation;
5
6
use BrenoRoosevelt\Validation\Contracts\Error;
7
use BrenoRoosevelt\Validation\Contracts\Rule;
8
9
final class AnError implements Error
10
{
11
    public function __construct(
12
        private string $message,
13
        private ?string $field = null,
14
        private ?Rule $rule = null
15
    ) {
16
    }
17
18
    /** @inheritDoc */
19
    public function message(): string
20
    {
21
        return $this->message;
22
    }
23
24
    /** @inheritDoc */
25
    public function field(): ?string
26
    {
27
        return $this->field;
28
    }
29
30
    /** @inheritDoc */
31
    public function rule(): ?Rule
32
    {
33
        return $this->rule;
34
    }
35
}
36