Passed
Push — main ( a20a2c...4724f2 )
by Breno
02:01
created

ErrorMessage   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 22
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A message() 0 3 1
A field() 0 3 1
A rule() 0 3 1
A __construct() 0 2 1
1
<?php
2
declare(strict_types=1);
3
4
namespace BrenoRoosevelt\Validation;
5
6
final class ErrorMessage implements Error
7
{
8
    public function __construct(private string $message, private Rule $rule, private ?string $field = null)
9
    {
10
    }
11
12
    /** @inheritDoc */
13
    public function message(): string
14
    {
15
        return $this->message;
16
    }
17
18
    /** @inheritDoc */
19
    public function field(): ?string
20
    {
21
        return $this->field;
22
    }
23
24
    /** @inheritDoc */
25
    public function rule(): Rule
26
    {
27
        return $this->rule;
28
    }
29
}
30