Conditions | 2 |
Paths | 1 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2.0185 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | public static function respondFrom($method) |
||
19 | { |
||
20 | 1 | return function ($meta = null) use ($method) { |
|
21 | 1 | array_push($method, [$meta]); |
|
22 | |||
23 | 1 | if (is_array($method[0])) { |
|
24 | $response = call_user_func_array(...$method); |
||
|
|||
25 | } else { |
||
26 | 1 | $response = app()->call(...$method); |
|
27 | } |
||
28 | |||
29 | 1 | throw new HttpResponseException($response); |
|
30 | 1 | }; |
|
33 |
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.