Completed
Pull Request — master (#289)
by Gavin
16:24 queued 13:47
created

MissingHostException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 0
cbo 0
dl 0
loc 19
ccs 0
cts 10
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A missingHost() 0 11 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 HttpCacheExceptionInterface
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 full URLs containing hostnames instead of paths '
30
            . 'or configure the caching proxy class with a hostname in the base path.',
31
            $path
32
        );
33
34
        return new MissingHostException($msg);
35
    }
36
}
37