InvalidFilter   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 80
c 0
b 0
f 0
wmc 7
lcom 0
cbo 2
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getCode() 0 4 1
A setCode() 0 4 1
A getMessage() 0 4 1
A setMessage() 0 4 1
A __construct() 0 5 1
A addAtIndex() 0 4 1
A offsetSet() 0 4 1
1
<?php
2
namespace Netdudes\DataSourceryBundle\Query;
3
4
use Netdudes\DataSourceryBundle\Query\Exception\MethodNotAllowedException;
5
6
class InvalidFilter extends Filter
7
{
8
    /**
9
     * A code to identify the reason the filter is invalid
10
     *
11
     * @var int
12
     */
13
    protected $code = 0;
14
15
    /**
16
     * A user-readable message describing the reason the filter is invalid
17
     *
18
     * @var string
19
     */
20
    protected $message;
21
22
    /**
23
     * @return int
24
     */
25
    public function getCode()
26
    {
27
        return $this->code;
28
    }
29
30
    /**
31
     * @param int $code
32
     */
33
    public function setCode($code)
34
    {
35
        $this->code = $code;
36
    }
37
38
    /**
39
     * @return string
40
     */
41
    public function getMessage()
42
    {
43
        return $this->message;
44
    }
45
46
    /**
47
     * @param string $message
48
     */
49
    public function setMessage($message)
50
    {
51
        $this->message = $message;
52
    }
53
54
    /**
55
     * @param array $message
56
     * @param int   $code
57
     */
58
    public function __construct($message, $code = 0)
59
    {
60
        $this->message = $message;
0 ignored issues
show
Documentation Bug introduced by
It seems like $message of type array is incompatible with the declared type string of property $message.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
61
        $this->code = $code;
62
    }
63
64
    /**
65
     * @param $index
66
     * @param $value
67
     *
68
     * @throws MethodNotAllowedException
69
     */
70
    public function addAtIndex($index, $value)
71
    {
72
        throw new MethodNotAllowedException(__CLASS__, __METHOD__, "Invalid filters must be empty");
73
    }
74
75
    /**
76
     * @param mixed $offset
77
     * @param mixed $value
78
     *
79
     * @throws MethodNotAllowedException
80
     */
81
    public function offsetSet($offset, $value)
82
    {
83
        throw new MethodNotAllowedException(__CLASS__, __METHOD__, "Invalid filters must be empty");
84
    }
85
}
86