Completed
Pull Request — master (#22)
by James
03:22
created

CacheException::fromNonMultiOperationCache()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 5
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 fromNonMultiOperationCache(DoctrineCache $cache) : self
12
    {
13 1
        return new self(sprintf(
14
            'The given cache %s does not support multiple operations, '
15 1
            . 'but you tried to use a feature that requires a multi-operation cache.',
16 1
            get_class($cache)
17
        ));
18
    }
19
}
20