-
-
Notifications
You must be signed in to change notification settings - Fork 440
Expand file tree
/
Copy pathCacheItem.php
More file actions
39 lines (33 loc) · 855 Bytes
/
CacheItem.php
File metadata and controls
39 lines (33 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
declare(strict_types=1);
namespace Rector\Caching\ValueObject;
/**
* Inspired by
* https://github.com/phpstan/phpstan-src/commit/eeae2da7999b2e8b7b04542c6175d46f80c6d0b9#diff-6dc14f6222bf150e6840ca44a7126653052a1cedc6a149b4e5c1e1a2c80eacdc
*/
final readonly class CacheItem
{
public function __construct(
private string $variableKey,
private mixed $data
) {
}
/**
* @param array<string, mixed> $properties
*/
public static function __set_state(array $properties): self
{
return new self($properties['variableKey'], $properties['data']);
}
public function isVariableKeyValid(string $variableKey): bool
{
return $this->variableKey === $variableKey;
}
/**
* @return mixed
*/
public function getData()
{
return $this->data;
}
}