private function decode($content) { $result = json_decode($content); if (json_last_error() !== JSON_ERROR_NONE) { throw new \Exception("The string '{$content}' is not valid json"); } return $result; }