Completed
Push — master ( dfda1d...2f160c )
by Lars
04:17 queued 18s
created

SerializerDefault   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 4 1
A unserialize() 0 4 1
A setUnserializeOptions() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace voku\cache;
6
7
/**
8
 * SerializerDefault: simple serialize / unserialize
9
 */
10
class SerializerDefault implements iSerializer
11
{
12
    /**
13
     * @var array
14
     */
15
    private $unserialize_options;
16
17
    /**
18
     * {@inheritdoc}
19
     */
20 20
    public function serialize($value)
21
    {
22 20
        return \serialize($value);
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28 9
    public function unserialize($value)
29
    {
30 9
        return \unserialize($value, $this->unserialize_options);
31
    }
32
33
    /**
34
     * @param array $options
35
     */
36 34
    public function setUnserializeOptions(array $options)
37
    {
38 34
        $this->unserialize_options = $options;
39 34
    }
40
}
41