NativeSerializer::unserialize()   A
last analyzed

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
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace NilPortugues\MessageBus\Serializer;
4
5
use NilPortugues\MessageBus\Serializer\Contracts\Serializer;
6
7
class NativeSerializer implements Serializer
8
{
9
    /**
10
     * Turns a data structure into a string that can be recovered.
11
     *
12
     * @param mixed $data
13
     *
14
     * @return string
15
     */
16
    public function serialize($data) : string
17
    {
18
        return serialize($data);
19
    }
20
21
    /**
22
     * Turns string data structure into an usable $data structure.
23
     *
24
     * @param string $data
25
     *
26
     * @return mixed
27
     */
28
    public function unserialize(string $data)
29
    {
30
        return unserialize($data);
31
    }
32
}
33