Total Complexity | 8 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | class Format implements IFormat |
||
15 | { |
||
16 | 1 | public function unpack($content) |
|
17 | { |
||
18 | 1 | if (is_numeric($content)) { |
|
19 | 1 | return $content; |
|
20 | } |
||
21 | 1 | if (is_bool($content)) { |
|
22 | 1 | return $content; |
|
23 | } |
||
24 | 1 | $encodeResult = json_decode(strval($content), true); |
|
25 | 1 | if (is_null($encodeResult)) { |
|
26 | // problems with decoding - return original string |
||
27 | 1 | return $content; |
|
28 | } |
||
29 | 1 | return $encodeResult; |
|
30 | } |
||
31 | |||
32 | 1 | public function pack($data) |
|
44 | } |
||
45 | } |
||
46 |