NonErrorResponseMatcher::matches()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 2
nc 2
nop 1
crap 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\ResponseMatcher;
13
14
use Symfony\Component\HttpFoundation\Response;
15
16
/**
17
 * "A cache MUST invalidate the effective Request URI ... when a non-error
18
 * status code is received in response to an unsafe request method".
19
 *
20
 * @see https://tools.ietf.org/html/rfc7234#section-4.4
21
 */
22
class NonErrorResponseMatcher implements ResponseMatcherInterface
23
{
24 11
    public function matches(Response $response)
25
    {
26 11
        return $response->getStatusCode() >= 200
27 11
            && $response->getStatusCode() < 400;
28
    }
29
}
30