Passed
Push — main ( f7f95e...c4cb1e )
by Breno
02:19
created

ErrorMessage   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A message() 0 3 1
A field() 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 ?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