Conditions | 5 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
44 | 6 | public function handleRefresh(CacheEvent $event) |
|
45 | { |
||
46 | 6 | $request = $event->getRequest(); |
|
47 | // BC - we can drop this check when we only support Symfony 3.1 and newer |
||
48 | 6 | $cacheable = method_exists(Request::class, 'isMethodCacheable') |
|
49 | 6 | ? $request->isMethodCacheable() |
|
50 | 6 | : $request->isMethodSafe(false); |
|
|
|||
51 | |||
52 | 6 | if (!$cacheable |
|
53 | 5 | || !$request->isNoCache() |
|
54 | 6 | || !$this->isRequestAllowed($request) |
|
55 | ) { |
||
56 | 5 | return; |
|
57 | } |
||
58 | |||
59 | 1 | $event->setResponse( |
|
60 | 1 | $event->getKernel()->fetch($request) |
|
61 | ); |
||
64 |
This check compares calls to functions or methods with their respective definitions. If the call has more 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.