Completed
Pull Request — master (#364)
by Alessandro
04:31
created

MissingHostException::missingHost()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 11
ccs 0
cts 10
cp 0
rs 9.4285
cc 1
eloc 7
nc 1
nop 1
crap 2
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
    public static function missingHost($path)
26
    {
27
        $msg = sprintf(
28
            'Path "%s" cannot be invalidated without a host. '
29
            .'Either invalidate with absolute URLs including the host name '
30
            .'or configure the base URI on the HttpDispatcher.',
31
            $path
32
        );
33
34
        return new self($msg);
35
    }
36
}
37