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

CacheException::fromNonMultiGetCache()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 4
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
            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