JsonSerializer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 20
ccs 2
cts 4
cp 0.5
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 4 1
A deserialize() 0 4 1
1
<?php
2
namespace Aeq\Hal\Serializer;
3
4
class JsonSerializer implements SerializerInterface
5
{
6
    /**
7
     * @param object|array $data
8
     * @return string
9
     */
10
    public function serialize($data)
11
    {
12
        return json_encode($data);
13
    }
14
15
    /**
16
     * @param string $str
17
     * @return array
18
     */
19 5
    public function deserialize($str)
20
    {
21 5
        return @json_decode($str, true);
22
    }
23
}
24