JsonCookie   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A decode() 0 6 1
A encode() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ONGR\CookiesBundle\Cookie\Model;
13
14
/**
15
 * Cookie class model to deal with cookies encoded in JSON.
16
 */
17
class JsonCookie extends GenericCookie
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22
    protected function decode($rawValue)
23
    {
24
        $value = json_decode($rawValue, true);
25
26
        return $value;
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    protected function encode($value)
33
    {
34
        $rawValue = json_encode($value);
35
36
        return $rawValue;
37
    }
38
}
39