ProxyResponseException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 14
ccs 6
cts 6
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A proxyResponse() 0 9 1
1
<?php
2
3
/*
4
 * This file is part of the FOSHttpCache 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\HttpCache\Exception;
13
14
use Http\Client\Exception\HttpException;
15
16
/**
17
 * Wrapping an error response from the caching proxy.
18
 */
19
class ProxyResponseException extends \RuntimeException implements HttpCacheException
20
{
21
    /**
22
     * @return ProxyResponseException
23
     */
24 3
    public static function proxyResponse(HttpException $exception)
25
    {
26 3
        $message = sprintf(
27 3
            '%s error response "%s" from caching proxy',
28 3
            $exception->getResponse()->getStatusCode(),
29 3
            $exception->getResponse()->getReasonPhrase()
30
        );
31
32 3
        return new self($message, 0, $exception);
33
    }
34
}
35