| Total Complexity | 6 |
| Total Lines | 80 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 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 | 126 | public function __construct($value) |
|
| 23 | { |
||
| 24 | 126 | $this->value = $value; |
|
| 25 | 126 | } |
|
| 26 | |||
| 27 | /** |
||
| 28 | * @return mixed |
||
| 29 | */ |
||
| 30 | 1 | public function __invoke() |
|
| 31 | { |
||
| 32 | 1 | return $this->value(); |
|
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * {@inheritdoc} |
||
| 37 | */ |
||
| 38 | 7 | public function apply(callable $callable) |
|
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * {@inheritdoc} |
||
| 47 | */ |
||
| 48 | abstract public function hash(): string; |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @return string |
||
| 52 | */ |
||
| 53 | abstract public function serialize(); |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @param string $serialized |
||
| 57 | * |
||
| 58 | * @return mixed |
||
| 59 | */ |
||
| 60 | abstract public function unserialize($serialized); |
||
| 61 | |||
| 62 | /** |
||
| 63 | * {@inheritdoc} |
||
| 64 | */ |
||
| 65 | 89 | public function value() |
|
| 66 | { |
||
| 67 | 89 | return $this->value; |
|
| 68 | } |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @param string $string |
||
| 72 | * The string to hash |
||
| 73 | * |
||
| 74 | * @return string |
||
| 75 | * The string's hash |
||
| 76 | */ |
||
| 77 | 28 | protected function doHash(string $string): string |
|
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * Set the value. |
||
| 84 | * |
||
| 85 | * @param mixed $value |
||
| 86 | */ |
||
| 87 | 15 | protected function set($value): void |
|
| 92 |