MissingHostException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 17
ccs 5
cts 5
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A missingHost() 0 10 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
/**
15
 * Thrown when there is no default host configured and an invalidation request
16
 * with just a path is made.
17
 */
18
class MissingHostException extends \RuntimeException implements HttpCacheException
19
{
20
    /**
21
     * @param string $path the path that was asked to be invalidated
22
     *
23
     * @return MissingHostException
24
     */
25 1
    public static function missingHost($path)
26
    {
27 1
        $msg = sprintf(
28 1
            'Path "%s" cannot be invalidated without a host. '
29
            .'Either invalidate with absolute URLs including the host name '
30 1
            .'or configure the base URI on the HttpDispatcher.',
31
            $path
32
        );
33
34 1
        return new self($msg);
35
    }
36
}
37