Passed
Push — master ( fd18cf...79da56 )
by Evgeniy
02:09
created

ValueDependency   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 2
eloc 4
c 1
b 1
f 0
dl 0
loc 18
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A generateDependencyData() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Cache\Dependency;
6
7
use Yiisoft\Cache\CacheInterface;
8
9
/**
10
 * ValueDependency represents a dependency based on the specified value in the constructor.
11
 *
12
 * The dependency is reported as unchanged if and only if the specified value is
13
 * the same as the one evaluated when storing the data to cache.
14
 */
15
final class ValueDependency extends Dependency
16
{
17
    /**
18
     * @var mixed
19
     */
20
    private $value;
21
22
    /**
23
     * @param mixed $value
24
     */
25 8
    public function __construct($value)
26
    {
27 8
        $this->value = $value;
28 8
    }
29
30 8
    protected function generateDependencyData(CacheInterface $cache)
31
    {
32 8
        return $this->value;
33
    }
34
}
35