Passed
Push — master ( a32f43...4dbc55 )
by Herberto
05:27
created

MessageViolationException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 3
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Werkspot\MessageBus\Bus\DeliveryChain\Middleware\Validation;
4
5
use RuntimeException;
6
7
class MessageViolationException extends RuntimeException
8
{
9
    /**
10
     * @var string
11
     */
12
    private $field;
13
14
    /**
15
     * @var string
16
     */
17
    private $error;
18
19
    /**
20
     * @var array
21
     */
22
    private $parameters;
23
24 3
    public function __construct(string $field, string $error, array $parameters = [])
25
    {
26 3
        $this->field = $field;
27 3
        $this->error = $error;
28 3
        $this->parameters = $parameters;
29
30 3
        parent::__construct($field . ': ' . $error);
31 3
    }
32
33 1
    public function getField(): string
34
    {
35 1
        return $this->field;
36
    }
37
38 1
    public function getError(): string
39
    {
40 1
        return $this->error;
41
    }
42
43 1
    public function getParameters(): array
44
    {
45 1
        return $this->parameters;
46
    }
47
}
48