GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#31)
by
unknown
02:42
created

ClosureEntitySerializer   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 46
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getType() 0 4 1
A serialize() 0 7 1
A unserialize() 0 4 1
1
<?php
2
3
namespace Zumba\JsonSerializer\EntitySerializers;
4
5
use SuperClosure\SerializerInterface as ClosureSerializerInterface;
6
use Zumba\Contracts\EntitySerializer;
7
use Zumba\JsonSerializer\JsonSerializer;
8
9
class ClosureEntitySerializer implements EntitySerializer
10
{
11
    /**
12
     * @var ClosureSerializerInterface
13
     */
14
    protected $closureSerializer;
15
16
    /**
17
     * ClosureEntitySerializer constructor.
18
     * @param $closureSerializer
19
     */
20
    public function __construct(ClosureSerializerInterface $closureSerializer)
21
    {
22
        $this->closureSerializer = $closureSerializer;
23
    }
24
25
    /**
26
     * @return string
27
     */
28
    public function getType()
29
    {
30
        return 'Closure';
31
    }
32
33
    /**
34
     * @param \Closure $object
35
     * @return array
36
     */
37
    public function serialize($object)
38
    {
39
        return [
40
            JsonSerializer::CLOSURE_IDENTIFIER_KEY => true,
41
            'value'                                => $this->closureSerializer->serialize($object)
42
        ];
43
    }
44
45
    /**
46
     * @param array $data
47
     * @return \Closure
48
     */
49
    public function unserialize($data)
50
    {
51
        return $this->closureSerializer->unserialize($data['value']);
52
    }
53
54
}
55