Completed
Push — master ( fc3afa...aedcee )
by Marco
8s
created

CacheException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 26
ccs 9
cts 9
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A fromNonClearableCache() 0 7 1
A fromNonMultiGetCache() 0 7 1
A fromNonMultiPutCache() 0 7 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Roave\DoctrineSimpleCache\Exception;
5
6
use Psr\SimpleCache\CacheException as PsrCacheException;
7
use Doctrine\Common\Cache\Cache as DoctrineCache;
8
9
final class CacheException extends \RuntimeException implements PsrCacheException
10
{
11 1
    public static function fromNonClearableCache(DoctrineCache $cache) : self
12
    {
13 1
        return new self(sprintf(
14 1
            'The given cache %s was not clearable, but you tried to use a feature that requires a clearable cache.',
15
            get_class($cache)
16
        ));
17
    }
18
19 1
    public static function fromNonMultiGetCache(DoctrineCache $cache) : self
20
    {
21 1
        return new self(sprintf(
22 1
            'The given cache %s cannot multi-get, but you tried to use a feature that requires a multi-get cache.',
23
            get_class($cache)
24
        ));
25
    }
26
27 1
    public static function fromNonMultiPutCache(DoctrineCache $cache) : self
28
    {
29 1
        return new self(sprintf(
30 1
            'The given cache %s cannot multi-put, but you tried to use a feature that requires a multi-put cache.',
31
            get_class($cache)
32
        ));
33
    }
34
}
35