Gzip   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 25
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 4 1
A unserialize() 0 4 1
1
<?php
2
/**
3
 * For the full copyright and license information, please view the LICENSE
4
 * file that was distributed with this source code.
5
 *
6
 * @author Igor Borodikhin <[email protected]>
7
 * @license MIT
8
 */
9
namespace Endeveit\Cache\Serializers;
10
11
use Endeveit\Cache\Interfaces\Serializer;
12
13
/**
14
 * Serializer that compresses data with gzip.
15
 */
16
class Gzip implements Serializer
17
{
18
19
    /**
20
     * {@inheritdoc}
21
     *
22
     * @param  mixed  $value
23
     * @return string
24
     */
25
    public function serialize($value)
26
    {
27
        return gzdeflate(serialize($value));
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     *
33
     * @param  string $str
34
     * @return mixed
35
     */
36
    public function unserialize($str)
37
    {
38
        return unserialize(gzinflate($str));
39
    }
40
}
41