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::unserialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 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