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

MessageViolationException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 39
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getParameters() 0 3 1
A getField() 0 3 1
A getError() 0 3 1
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