Total Complexity | 5 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | final class Parser |
||
6 | { |
||
7 | private $cache; |
||
8 | private $rules; |
||
9 | |||
10 | public function __construct(Repository $rules) |
||
13 | } |
||
14 | |||
15 | /** |
||
16 | * Converts validation string into an array of rule instances. |
||
17 | * |
||
18 | * @param string $string validation string like "equal_to:foo|not_equal_to:bar" |
||
19 | * |
||
20 | * @return RuleInterface[] |
||
21 | */ |
||
22 | public function parse($string) |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Takes rule identifier and arguments from the string. |
||
37 | * |
||
38 | * @param string $rule |
||
39 | * |
||
40 | * @return array |
||
41 | */ |
||
42 | private function getNameAndArguments($rule) |
||
56 |
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.