1<?php
2
3declare(strict_types=1);
4
5/**
6 * @copyright Copyright (c) 2020 Jonas Rittershofer <jotoeri@users.noreply.github.com>
7 *
8 * @author affan98 <affan98@gmail.com>
9 * @author Jonas Rittershofer <jotoeri@users.noreply.github.com>
10 * @author Roeland Jago Douma <roeland@famdouma.nl>
11 *
12 * @license GNU AGPL version 3 or any later version
13 *
14 * This program is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Affero General Public License as
16 * published by the Free Software Foundation, either version 3 of the
17 * License, or (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 * GNU Affero General Public License for more details.
23 *
24 * You should have received a copy of the GNU Affero General Public License
25 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 *
27 */
28
29namespace OCA\Forms\Db;
30
31use OCP\AppFramework\Db\Entity;
32
33/**
34 * @method integer getSubmissionId()
35 * @method void setSubmissionId(integer $value)
36 * @method integer getQuestionId()
37 * @method void setQuestionId(integer $value)
38 * @method string getText()
39 * @method void setText(string $value)
40 */
41class Answer extends Entity {
42	protected $submissionId;
43	protected $questionId;
44	protected $text;
45
46	/**
47	 * Answer constructor.
48	 */
49	public function __construct() {
50		$this->addType('submissionId', 'integer');
51		$this->addType('questionId', 'integer');
52	}
53
54	public function read(): array {
55		return [
56			'id' => $this->getId(),
57			'submissionId' => $this->getSubmissionId(),
58			'questionId' => $this->getQuestionId(),
59			'text' => htmlspecialchars_decode($this->getText()),
60		];
61	}
62}
63