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