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

Error::getParameters()   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
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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