CheckError::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 10
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Smoren\Validator\Exceptions;
6
7
class CheckError extends \DomainException
8
{
9
    /**
10
     * @var string
11
     */
12
    protected string $name;
13
    /**
14
     * @var mixed
15
     */
16
    protected $value;
17
    /**
18
     * @var array<string, mixed>
19
     */
20
    protected array $params;
21
22
    /**
23
     * @param string $name
24
     * @param mixed $value
25
     * @param array<string, mixed> $params
26
     */
27 164
    public function __construct(string $name, $value, array $params)
28
    {
29 164
        parent::__construct('Check error');
30 164
        $this->name = $name;
31 164
        $this->value = $value;
32 164
        $this->params = $params;
33
    }
34
35
    /**
36
     * @return string
37
     */
38 164
    public function getName(): string
39
    {
40 164
        return $this->name;
41
    }
42
43
    /**
44
     * @return mixed
45
     */
46 1
    public function getValue()
47
    {
48 1
        return $this->value;
49
    }
50
51
    /**
52
     * @return array<string, mixed>
53
     */
54 164
    public function getParams(): array
55
    {
56 164
        return $this->params;
57
    }
58
59
    /**
60
     * @param CheckError $e
61
     *
62
     * @return bool
63
     */
64 2
    public function equalTo(CheckError $e): bool
65
    {
66 2
        return $this->name === $e->name
67 2
            && $this->value === $e->value
68 2
            && $this->params === $e->params;
69
    }
70
}
71