1 | <?php |
||
6 | class SimplePropertyParser implements PropertyParser |
||
7 | { |
||
8 | /** |
||
9 | * |
||
10 | * @var \Mcustiel\SimpleRequest\Interfaces\ValidatorInterface[] |
||
11 | */ |
||
12 | protected $validators = []; |
||
13 | /** |
||
14 | * |
||
15 | * @var \Mcustiel\SimpleRequest\Interfaces\FilterInterface[] |
||
16 | */ |
||
17 | protected $filters = []; |
||
18 | /** |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $name; |
||
23 | |||
24 | 97 | public function __construct($name) |
|
25 | 1 | { |
|
26 | 97 | $this->name = $name; |
|
27 | 97 | } |
|
28 | |||
29 | 95 | public function setFilters(array $filters) |
|
30 | { |
||
31 | 95 | $this->filters = $filters; |
|
32 | 95 | return $this; |
|
33 | } |
||
34 | |||
35 | 95 | public function setValidators(array $validators) |
|
36 | { |
||
37 | 95 | $this->validators = $validators; |
|
38 | 95 | return $this; |
|
39 | } |
||
40 | |||
41 | 97 | public function getName() |
|
42 | { |
||
43 | 97 | return $this->name; |
|
44 | } |
||
45 | |||
46 | /** |
||
47 | * Filters and validates a value. And return the filtered value. |
||
48 | * It throws an exception if the value is not valid. |
||
49 | * |
||
50 | * @param mixed $value |
||
|
|||
51 | * |
||
52 | * @return mixed |
||
53 | * |
||
54 | * @throws \Mcustiel\SimpleRequest\Exception\InvalidValueException |
||
55 | */ |
||
56 | 96 | public function parse($propertyValue) |
|
64 | |||
65 | /** |
||
66 | * Returns a copy of the received value. |
||
67 | * |
||
68 | * @param mixed $value |
||
69 | * |
||
70 | * @return mixed |
||
71 | */ |
||
72 | 98 | protected function cloneValue($value) |
|
79 | |||
80 | /** |
||
81 | * Checks the value against all validators. |
||
82 | * |
||
83 | * @param mixed $value |
||
84 | * |
||
85 | * @throws \Mcustiel\SimpleRequest\Exception\InvalidValueException |
||
86 | */ |
||
87 | 97 | protected function validate($value) |
|
97 | |||
98 | /** |
||
99 | * Run all the filters on the value. |
||
100 | * |
||
101 | * @param mixed $value |
||
102 | * |
||
103 | * @return mixed |
||
104 | */ |
||
105 | 97 | protected function runFilters($value) |
|
114 | } |
||
115 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.