Completed
Push — master ( e33bed...05c971 )
by Pol
02:19
created

ClosureObject::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace drupol\valuewrapper\Object;
4
5
use SuperClosure\Serializer;
6
7
/**
8
 * Class ClosureObject
9
 */
10
class ClosureObject extends ObjectValue
11
{
12
    /**
13
     * ClosureObject constructor.
14
     *
15
     * @param \Closure $value
16
     */
17 4
    public function __construct(\Closure $value)
18
    {
19 4
        parent::__construct($value);
20 4
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25 1
    public function hash(): string
26
    {
27 1
        $serializer = new Serializer();
28
29 1
        return $this->doHash($serializer->serialize($this->get()));
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35 1
    public function __invoke()
36
    {
37 1
        return \call_user_func_array($this->get(), \func_get_args());
38
    }
39
}
40