Passed
Pull Request — master (#222)
by Dmitriy
12:29
created

Error   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 1
Metric Value
eloc 10
c 2
b 1
f 1
dl 0
loc 36
ccs 10
cts 10
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getAttribute() 0 3 1
A __construct() 0 5 1
A getParameters() 0 3 1
A getMessage() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator;
6
7
final class Error
8
{
9
    private string $message;
10
11
    /**
12
     * @psalm-var list<int|string>
13
     */
14
    private array $parameters;
15
    private ?string $attribute;
16
17
    /**
18
     * @psalm-param list<int|mixed> $parameters
19
     */
20 269
    public function __construct(string $message, array $parameters, ?string $attribute = null)
21
    {
22 269
        $this->message = $message;
23 269
        $this->parameters = $parameters;
24 269
        $this->attribute = $attribute;
25
    }
26
27 16
    public function getMessage(): string
28
    {
29 16
        return $this->message;
30
    }
31
32
    /**
33
     * @psalm-return list<int|string>
34
     */
35 16
    public function getParameters(): array
36
    {
37 16
        return $this->parameters;
38
    }
39
40 17
    public function getAttribute(): ?string
41
    {
42 17
        return $this->attribute;
43
    }
44
}
45