@@ 42-51 (lines=10) @@ | ||
39 | * |
|
40 | * @return array |
|
41 | */ |
|
42 | public function jsonDecode($plain) |
|
43 | { |
|
44 | $data = json_decode($plain, true); |
|
45 | ||
46 | if (json_last_error() != JSON_ERROR_NONE) { |
|
47 | throw new \RuntimeException(self::$messages[json_last_error()]); |
|
48 | } |
|
49 | ||
50 | return $data; |
|
51 | } |
|
52 | ||
53 | /** |
|
54 | * @param string $base64Encoded |
@@ 39-48 (lines=10) @@ | ||
36 | * |
|
37 | * @return string |
|
38 | */ |
|
39 | public function jsonEncode($data) |
|
40 | { |
|
41 | $plain = json_encode($data); |
|
42 | ||
43 | if (json_last_error() != JSON_ERROR_NONE) { |
|
44 | throw new \RuntimeException(self::$messages[json_last_error()]); |
|
45 | } |
|
46 | ||
47 | return $plain; |
|
48 | } |
|
49 | ||
50 | /** |
|
51 | * @param string $base64Decoded |