answer_id = $answer_id; $this->question_id = $question_id; $this->answer = $answer; $this->is_true = $is_true; } /** * @return mixed */ public function getAnswerId() { return $this->answer_id; } /** * @return mixed */ public function getQuestionId() { return $this->question_id; } /** * @return mixed */ public function getAnswer() { return $this->answer; } /** * @return mixed */ public function getIsTrue() { return $this->is_true; } public function jsonSerialize() { $data = []; foreach ($this as $key => $val) { if ($val !== null) $data[$key] = $val; } return $data; } }