Completed
Pull Request — master (#354)
by David de
06:18
created

NonErrorResponseMatcher::matches()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
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 9
    public function matches(Response $response)
25
    {
26 9
        return $response->getStatusCode() >= 200
27 9
            && $response->getStatusCode() < 400;
28
    }
29
}
30