ValueDependency   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A generateDependencyData() 0 3 1
A __construct() 0 2 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
    public function __construct(private mixed $value)
18
    {
19 8
    }
20
21 8
    protected function generateDependencyData(CacheInterface $cache): mixed
22
    {
23
        return $this->value;
24 8
    }
25
}
26