CacheException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fromNonClearableCache() 0 7 1
A fromNonMultiOperationCache() 0 8 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 1
            get_class($cache)
16
        ));
17
    }
18
19 1
    public static function fromNonMultiOperationCache(DoctrineCache $cache) : self
20
    {
21 1
        return new self(sprintf(
22
            'The given cache %s does not support multiple operations, '
23 1
            . 'but you tried to use a feature that requires a multi-operation cache.',
24 1
            get_class($cache)
25
        ));
26
    }
27
}
28