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 | 101 | public function __construct($value) |
|
26 | |||
27 | /** |
||
28 | * {@inheritdoc} |
||
29 | */ |
||
30 | 68 | public function value() |
|
31 | { |
||
32 | 68 | return $this->value; |
|
33 | } |
||
34 | |||
35 | /** |
||
36 | * {@inheritdoc} |
||
37 | */ |
||
38 | 1 | public function __invoke() |
|
42 | |||
43 | /** |
||
44 | * {@inheritdoc} |
||
45 | */ |
||
46 | 7 | public function apply(callable $callable) |
|
52 | |||
53 | /** |
||
54 | * {@inheritdoc} |
||
55 | */ |
||
56 | abstract public function serialize(); |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | abstract public function unserialize($serialized); |
||
62 | |||
63 | /** |
||
64 | * @param string $string |
||
65 | * The string to hash. |
||
66 | * |
||
67 | * @return string |
||
68 | * The string's hash. |
||
69 | */ |
||
70 | 14 | protected function doHash(string $string) : string |
|
74 | |||
75 | /** |
||
76 | * Set the value. |
||
77 | * |
||
78 | * @param mixed $value |
||
79 | */ |
||
80 | 8 | protected function set($value) |
|
84 | } |
||
85 |