CacheException   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 35
ccs 8
cts 8
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A adapterAlreadyExists() 0 4 1
A adapterNameNotString() 0 4 1
A adapterDoesNotExist() 0 4 1
A defaultAdapterNotSet() 0 4 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