1: <?php
2:
3: namespace PHPixie\HTTPProcessors\Parsers\Parser;
4:
5: class JSON implements \PHPixie\HTTPProcessors\Parsers\Parser
6: {
7: public function parse($string)
8: {
9: $parsed = json_decode($string, true);
10:
11: $errorCode = json_last_error();
12: if($errorCode !== JSON_ERROR_NONE) {
13: throw new \PHPixie\HTTPProcessors\Exception("Error parsing JSON data");
14: }
15:
16: return $parsed;
17: }
18: }