1 | <?php |
||
10 | abstract class AbstractValue implements ValueInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var mixed |
||
14 | */ |
||
15 | private $value; |
||
16 | |||
17 | /** |
||
18 | * AbstractValue constructor. |
||
19 | * |
||
20 | * @param mixed $value |
||
21 | */ |
||
22 | 80 | public function __construct($value) |
|
26 | |||
27 | /** |
||
28 | * {@inheritdoc} |
||
29 | */ |
||
30 | 53 | public function value() |
|
31 | { |
||
32 | 53 | return $this->value; |
|
33 | } |
||
34 | |||
35 | /** |
||
36 | * {@inheritdoc} |
||
37 | */ |
||
38 | 1 | public function __invoke() |
|
42 | |||
43 | abstract public function serialize(); |
||
44 | |||
45 | abstract public function unserialize($serialized); |
||
46 | |||
47 | /** |
||
48 | * @param string $string |
||
49 | * The string to hash. |
||
50 | * |
||
51 | * @return string |
||
52 | * The string's hash. |
||
53 | */ |
||
54 | 14 | protected function doHash(string $string) : string |
|
58 | |||
59 | /** |
||
60 | * Set the value. |
||
61 | * |
||
62 | * @param mixed $value |
||
63 | */ |
||
64 | 8 | protected function set($value) |
|
68 | } |
||
69 |