/** Initialize the response object. * * @return void */ protected function _initialize() { parent::_initialize(); if ($this->getDecodedJson()->status != self::STATUS_OK) { throw new JsonApi_Response_Exception(sprintf('Received unexpected "%s" status value for success message.', $this->getDecodedJson()->status)); } $this->_initDetail(); }
/** Init the response object. * * @throws JsonApi_Response_Exception If response JSON is malformed. * @return void */ protected function _initialize() { parent::_initialize(); if ($this->getDecodedJson()->status != self::STATUS_FAIL) { throw new JsonApi_Response_Exception(sprintf('Received unexpected "%s" status value for failure message.', $this->getDecodedJson()->status)); } $this->_initDetail(); /* Convert errors into an array. */ $props = $this->getPropertiesObject(); $props->set(self::KEY_ERRORS, (array) $props->get(self::KEY_ERRORS)); }