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

ValueDependency::generateDependencyData()   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 1
Bugs 1 Features 0
Metric Value
eloc 1
c 1
b 1
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 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