@@ -10,23 +10,25 @@ class DefaultSerializer implements Serializer
10
10
11
11
public function serialize (mixed $ value ): string
12
12
{
13
- return serialize ($ this ->getCacheValue ($ value ));
13
+ return serialize ($ this ->getCacheData ($ value ));
14
14
}
15
15
16
16
public function unserialize (string $ serializedValue ): mixed
17
17
{
18
- $ valueProperties = unserialize ($ serializedValue );
18
+ $ cacheProperties = unserialize ($ serializedValue );
19
19
20
- if (! $ this ->containsValidCacheProperties ($ valueProperties )) {
21
- throw CouldNotUnserialize::serializedCacheData ($ serializedValue );
20
+ if (! $ this ->containsValidCacheProperties ($ cacheProperties )) {
21
+ throw CouldNotUnserialize::serializedCacheValue ($ serializedValue );
22
22
}
23
23
24
- return $ this ->buildCacheValue ($ valueProperties );
24
+ return $ this ->buildCacheValue ($ cacheProperties );
25
25
}
26
26
27
- protected function getCacheValue (mixed $ value ): array
27
+ protected function getCacheData (mixed $ value ): array
28
28
{
29
- return compact ('data ' , 'type ' );
29
+ $ type = static ::CACHE_TYPE_NORMAL ;
30
+
31
+ return compact ('value ' , 'type ' );
30
32
}
31
33
32
34
protected function containsValidCacheProperties (mixed $ properties ): bool
@@ -35,13 +37,13 @@ protected function containsValidCacheProperties(mixed $properties): bool
35
37
return false ;
36
38
}
37
39
38
- return isset ($ properties ['data ' ]);
40
+ return isset ($ properties ['value ' ]);
39
41
}
40
42
41
- protected function buildCacheValue (array $ dataProperties ): mixed
43
+ protected function buildCacheValue (array $ cacheProperties ): mixed
42
44
{
43
- // $type = $dataProperties ['type'] ?? static::CACHE_TYPE_NORMAL;
45
+ $ type = $ cacheProperties ['type ' ] ?? static ::CACHE_TYPE_NORMAL ;
44
46
45
- return $ dataProperties [ ' data ' ];
47
+ return $ cacheProperties [ ' value ' ];
46
48
}
47
49
}
0 commit comments