CacheException::defaultAdapterNotSet()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/*
3
 * This file is part of the Egils\Component\Cache package.
4
 *
5
 * (c) Egidijus Lukauskas <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Egils\Component\Cache;
12
13
use Exception;
14
use Psr\Cache\CacheException as CacheExceptionInterface;
15
16
class CacheException extends Exception implements CacheExceptionInterface
17
{
18
    /**
19
     * @param string $name
20
     * @return CacheException
21
     */
22 1
    public static function adapterAlreadyExists($name)
23
    {
24 1
        return new static('Adapter \'' . $name . '\' already exists');
25
    }
26
27
    /**
28
     * @param string $name
29
     * @return CacheException
30
     */
31 1
    public static function adapterNameNotString($name)
32
    {
33 1
        return new static('Adapter name expected to be string, ' . gettype($name) . ' given');
34
    }
35
36
    /**
37
     * @param string $name
38
     * @return CacheException
39
     */
40 4
    public static function adapterDoesNotExist($name)
41
    {
42 4
        return new static('Adapter \'' . $name . '\' does not exist');
43
    }
44
45
    /** @return CacheException */
46 1
    public static function defaultAdapterNotSet()
47
    {
48 1
        return new static('Default adapter is not set');
49
    }
50
}
51