Passed
Push — master ( ab102c...5f4e36 )
by Alexander
02:10
created

SetCacheException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 8
c 0
b 0
f 0
dl 0
loc 31
ccs 9
cts 9
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getItem() 0 3 1
A __construct() 0 5 1
A getValue() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Cache\Exception;
6
7
use Yiisoft\Cache\Metadata\CacheItem;
8
9
final class SetCacheException extends CacheException
10
{
11
    /**
12
     * @var mixed
13
     */
14
    private $value;
15
    private CacheItem $item;
16
17
    /**
18
     * @param string $key
19
     * @param mixed $value
20
     * @param CacheItem $item
21
     */
22 2
    public function __construct(string $key, $value, CacheItem $item)
23
    {
24 2
        $this->value = $value;
25 2
        $this->item = $item;
26 2
        parent::__construct($key, 'Failed to store the value in the cache.');
27 2
    }
28
29
    /**
30
     * @return mixed
31
     */
32 1
    public function getValue()
33
    {
34 1
        return $this->value;
35
    }
36
37 1
    public function getItem(): CacheItem
38
    {
39 1
        return $this->item;
40
    }
41
}
42