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

SetCacheException::getItem()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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