/** * The generate functions outputs the correct headers for * this `JSONPage`, adds `$this->getHttpStatusCode()` code to the root attribute * before calling the parent generate function and generating * the `$this->_Result` json string * * @param null $page * @return string */ public function generate($page = null) { // Set the actual status code in the xml response $this->_Result['status'] = $this->getHttpStatusCode(); parent::generate($page); return json_encode($this->_Result); }
/** * The generate functions outputs the correct headers for * this `XMLPage`, adds `$this->getHttpStatusCode()` code to the root attribute * before calling the parent generate function and generating * the `$this->_Result` XMLElement * * @param null $page * @return string */ public function generate($page = null) { // Set the actual status code in the xml response $this->_Result->setAttribute('status', $this->getHttpStatusCode()); parent::generate($page); return $this->_Result->generate(true); }