|
@@ 184-191 (lines=8) @@
|
| 181 |
|
* @return JSend the decoded jSend succes object. |
| 182 |
|
* @throws \UnexpectedValueException |
| 183 |
|
*/ |
| 184 |
|
public static function decodeSucces(array $json) |
| 185 |
|
{ |
| 186 |
|
if (!array_key_exists('data', $json)) { |
| 187 |
|
throw new \UnexpectedValueException('JSend success objects require data.'); |
| 188 |
|
} |
| 189 |
|
|
| 190 |
|
return self::success($json['data']); |
| 191 |
|
} |
| 192 |
|
|
| 193 |
|
/** |
| 194 |
|
* Returns the decoded jSend fail object. |
|
@@ 200-207 (lines=8) @@
|
| 197 |
|
* @return JSend the decoded jSend fail object. |
| 198 |
|
* @throws \UnexpectedValueException |
| 199 |
|
*/ |
| 200 |
|
public static function decodeFail(array $json) |
| 201 |
|
{ |
| 202 |
|
if (!array_key_exists('data', $json)) { |
| 203 |
|
throw new \UnexpectedValueException('JSend fail objects require data.'); |
| 204 |
|
} |
| 205 |
|
|
| 206 |
|
return self::fail($json['data']); |
| 207 |
|
} |
| 208 |
|
|
| 209 |
|
/** |
| 210 |
|
* Returns the decoded jSend error object. |