UnsafeRequestMatcher   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 15
ccs 3
cts 4
cp 0.75
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A matches() 0 12 2
1
<?php
2
3
/*
4
 * This file is part of the FOSHttpCacheBundle package.
5
 *
6
 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace FOS\HttpCacheBundle\Http\RequestMatcher;
13
14
use Symfony\Component\HttpFoundation\Request;
15
use Symfony\Component\HttpFoundation\RequestMatcherInterface;
16
use Symfony\Component\HttpKernel\Kernel;
17
18
class UnsafeRequestMatcher implements RequestMatcherInterface
19
{
20 21
    public function matches(Request $request)
21
    {
22
        // hack needed for compatibility with SF 3.4 => 4.3
23
        // sf 3.4 => isMethodSafe(false)
24
        // sf 4.3 => isMethodSafe() or isMethodSafe(false)
25
        // sf 4.4 => isMethodSafe()
26 21
        if (Kernel::VERSION_ID >= 40300) {
27 21
            return !$request->isMethodSafe();
28
        } else {
29
            return !$request->isMethodSafe(false);
0 ignored issues
show
Unused Code introduced by
The call to Request::isMethodSafe() has too many arguments starting with false.

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.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
30
        }
31
    }
32
}
33