You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.2 KiB
66 lines
1.2 KiB
<?php
|
|
|
|
//答案类
|
|
class Answer implements JsonSerializable
|
|
{
|
|
private $answer_id;
|
|
private $question_id;
|
|
private $answer;
|
|
private $is_true;
|
|
|
|
/**
|
|
* Answer constructor.
|
|
* @param $answer_id
|
|
* @param $question_id
|
|
* @param $answer
|
|
* @param $is_true
|
|
*/
|
|
public function __construct($answer_id, $question_id, $answer, $is_true)
|
|
{
|
|
$this->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;
|
|
}
|
|
} |