CheckError   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
dl 0
loc 62
ccs 15
cts 15
cp 1
rs 10
c 1
b 0
f 0
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A __construct() 0 6 1
A getParams() 0 3 1
A getValue() 0 3 1
A equalTo() 0 5 3
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