Completed
Pull Request — master (#7)
by lee
23:32 queued 10s
created

DataPacker   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A pack() 0 4 1
A unpack() 0 4 1
1
<?php
2
3
/**
4
 * Class to prepare profiler data to dave in db
5
 * @maintainer Timur Shagiakhmetov <[email protected]>
6
 */
7
8
namespace Badoo\LiveProfiler;
9
10
class DataPacker implements DataPackerInterface
11
{
12
    /**
13
     * @param array $data
14
     * @return string
15
     */
16 5
    public function pack(array $data)
17
    {
18 5
        return json_encode($data);
19
    }
20
21
    /**
22
     * @param string $data
23
     * @return array
24
     */
25 1
    public function unpack($data)
26
    {
27 1
        return json_decode($data, true);
28
    }
29
}
30