InvalidSelectionException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 11
c 1
b 0
f 0
dl 0
loc 33
ccs 11
cts 11
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A getValidOptions() 0 3 1
1
<?php
2
3
namespace GloBee\PaymentApi\Exceptions\Validation;
4
5
class InvalidSelectionException extends ValidationException
6
{
7
    /**
8
     * @var array
9
     */
10
    private $options;
11
12
    /**
13
     * InvalidSelectionException constructor.
14
     *
15
     * @param string $field
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
16
     * @param mixed  $value
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
17
     * @param array $options
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
18
     */
19 1
    public function __construct($field, $value, array $options)
0 ignored issues
show
Coding Style introduced by
Type hint "string" missing for $field
Loading history...
20
    {
21 1
        $this->options = $options;
22 1
        $message = sprintf('The selected %s is invalid.', $field);
23
        $error = [
24 1
            'type' => 'invalid_selection',
25 1
            'extra' => $options,
26 1
            'field' => $field,
27 1
            'message' => $message,
28
        ];
29 1
        parent::__construct([$error], $message);
30 1
    }
31
32
    /**
33
     * @return array
34
     */
35 1
    public function getValidOptions()
36
    {
37 1
        return $this->options;
38
    }
39
}
40