/** * Suggestion constructor. * @param string $type * @param array $params */ public function __construct($type, array $params = null) { if ($params) { if (array_key_exists('value', $params)) { $this->setValue($params['value']); } if (array_key_exists('unrestricted_value', $params)) { $this->setUnrestrictedValue($params['unrestricted_value']); } if (array_key_exists('data', $params)) { $data = ResponseData::getInstance($type, $params['data']); $this->setData($data); } } }
public function __construct($msg = '数据库错误。') { parent::__construct(null, 900, $msg); }
/** * @return string */ public function getAsString() : string { return json_encode($this->data->getAsAssociativeArray()); }