| Total Complexity | 6 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 25 | class JsonPacker implements PackerInterface |
||
| 26 | { |
||
| 27 | /** |
||
| 28 | * Get cache type (might be used as file extension) |
||
| 29 | * |
||
| 30 | * @return string |
||
| 31 | */ |
||
| 32 | public function getType() |
||
| 33 | { |
||
| 34 | return 'json'; |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Pack the value |
||
| 39 | * |
||
| 40 | * @param mixed $value |
||
| 41 | * @return string |
||
| 42 | */ |
||
| 43 | public function pack($value) |
||
| 44 | { |
||
| 45 | return json_encode($value); |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Unpack the value |
||
| 50 | * |
||
| 51 | * @param string $packed |
||
| 52 | * @return mixed |
||
| 53 | * @throws InvalidArgumentException |
||
| 54 | */ |
||
| 55 | public function unpack($packed) |
||
| 68 | } |
||
| 69 | } |
||
| 70 |