Total Complexity | 6 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | class ClosureObject extends ObjectValue |
||
18 | { |
||
19 | /** |
||
20 | * @var \SuperClosure\Serializer |
||
21 | */ |
||
22 | private $serializer; |
||
23 | |||
24 | /** |
||
25 | * ClosureObject constructor. |
||
26 | * |
||
27 | * @param Closure $value |
||
28 | */ |
||
29 | 9 | public function __construct(Closure $value) |
|
30 | { |
||
31 | 9 | parent::__construct($value); |
|
32 | |||
33 | 9 | $this->serializer = new Serializer(); |
|
34 | 9 | } |
|
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | 2 | public function __invoke() |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | 2 | public function hash(): string |
|
48 | { |
||
49 | 2 | return $this->doHash($this->type() . $this->serializer->serialize($this->value())); |
|
50 | } |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | 1 | public function serialize() |
|
59 | ]); |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * {@inheritdoc} |
||
64 | */ |
||
65 | 1 | public function unserialize($serialized) |
|
78 |