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

ClosureObject   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 30
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A hash() 0 6 1
A __invoke() 0 4 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