CacheException::fromNonMultiOperationCache()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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