Skip to content

Commit 9c17c57

Browse files
committed
wip
1 parent 08b220d commit 9c17c57

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/Serializers/DefaultSerializer.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,25 @@ class DefaultSerializer implements Serializer
1010

1111
public function serialize(mixed $value): string
1212
{
13-
return serialize($this->getCacheValue($value));
13+
return serialize($this->getCacheData($value));
1414
}
1515

1616
public function unserialize(string $serializedValue): mixed
1717
{
18-
$valueProperties = unserialize($serializedValue);
18+
$cacheProperties = unserialize($serializedValue);
1919

20-
if (! $this->containsValidCacheProperties($valueProperties)) {
21-
throw CouldNotUnserialize::serializedCacheData($serializedValue);
20+
if (! $this->containsValidCacheProperties($cacheProperties)) {
21+
throw CouldNotUnserialize::serializedCacheValue($serializedValue);
2222
}
2323

24-
return $this->buildCacheValue($valueProperties);
24+
return $this->buildCacheValue($cacheProperties);
2525
}
2626

27-
protected function getCacheValue(mixed $value): array
27+
protected function getCacheData(mixed $value): array
2828
{
29-
return compact('data', 'type');
29+
$type = static::CACHE_TYPE_NORMAL;
30+
31+
return compact('value', 'type');
3032
}
3133

3234
protected function containsValidCacheProperties(mixed $properties): bool
@@ -35,13 +37,13 @@ protected function containsValidCacheProperties(mixed $properties): bool
3537
return false;
3638
}
3739

38-
return isset($properties['data']);
40+
return isset($properties['value']);
3941
}
4042

41-
protected function buildCacheValue(array $dataProperties): mixed
43+
protected function buildCacheValue(array $cacheProperties): mixed
4244
{
43-
// $type = $dataProperties['type'] ?? static::CACHE_TYPE_NORMAL;
45+
$type = $cacheProperties['type'] ?? static::CACHE_TYPE_NORMAL;
4446

45-
return $dataProperties['data'];
47+
return $cacheProperties['value'];
4648
}
4749
}

0 commit comments

Comments
 (0)