'faq-online', 'api-version' => 1.0, 'data' => array(), 'success' => false ); /** * @param array $a_response */ public function setResponse( array $a_response ) { $this->response['data'] = $a_response; } public function getResponse() { return json_encode( $this->response ); } public function setHeaderCode( $a_code ) { $codes = array( 500 => 'Internal Server error', 901 => 'Question-cannot-be-asked', 902 => 'Answer-cannot-be-set', 903 => 'wrong-parameters-given', 905 => 'User-is-not-owner', ); $text = isset( $codes[$a_code] ) ? $codes[$a_code] : "Error"; header("HTTP/1.1 $a_code $text" ); } public function setSuccess( bool $a_success ) { $this->response['success'] = $a_success; } }