Completed
Push — master ( 28797f...652832 )
by Alexander
01:44
created

SetCacheException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 12
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 6
1
<?php
2
namespace Yiisoft\Cache\Exception;
3
4
use Yiisoft\Cache\CacheInterface;
5
6
final class SetCacheException extends CacheException
7
{
8
    /**
9
     * @var string
10
     */
11
    private $key;
12
    private $value;
13
14
    /**
15
     * @var CacheInterface
16
     */
17
    private $cache;
18
19
    public function __construct(
20
        string $key,
21
        $value,
22
        CacheInterface $cache,
23
        $message = 'Could not store the value in the cache',
24
        $code = 0,
25
        \Throwable $previous = null
26
    ) {
27
        $this->key = $key;
28
        $this->value = $value;
29
        $this->cache = $cache;
30
        parent::__construct($message, $code, $previous);
31
    }
32
33
    public function getKey(): string
34
    {
35
        return $this->key;
36
    }
37
38
    /**
39
     * @return mixed
40
     */
41
    public function getValue()
42
    {
43
        return $this->value;
44
    }
45
46
    public function getCache(): CacheInterface
47
    {
48
        return $this->cache;
49
    }
50
}
51