Completed
Push — master ( d31297...b14507 )
by René
04:36 queued 12s
created

Vote::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 8
ccs 0
cts 7
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @copyright Copyright (c) 2017 Vinzenz Rosenkranz <[email protected]>
4
 *
5
 * @author Vinzenz Rosenkranz <[email protected]>
6
 * @author Kai Schröer <[email protected]>
7
 * @author René Gieling <[email protected]>
8
*
9
 * @license GNU AGPL version 3 or any later version
10
 *
11
 *  This program is free software: you can redistribute it and/or modify
12
 *  it under the terms of the GNU Affero General Public License as
13
 *  published by the Free Software Foundation, either version 3 of the
14
 *  License, or (at your option) any later version.
15
 *
16
 *  This program is distributed in the hope that it will be useful,
17
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 *  GNU Affero General Public License for more details.
20
 *
21
 *  You should have received a copy of the GNU Affero General Public License
22
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
 *
24
 */
25
26
namespace OCA\Polls\Db;
27
28
use JsonSerializable;
29
30
use OCP\AppFramework\Db\Entity;
31
32
/**
33
 * @method integer getPollId()
34
 * @method void setPollId(integer $value)
35
 * @method string getUserId()
36
 * @method void setUserId(string $value)
37
 * @method integer getVoteOptionId()
38
 * @method void setVoteOptionId(integer $value)
39
 * @method string getVoteOptionText()
40
 * @method void setVoteOptionText(string $value)
41
 * @method string getVoteAnswer()
42
 * @method void setVoteAnswer(string $value)
43
 */
44
class Vote extends Entity implements JsonSerializable {
45
	protected $pollId;
46
	protected $userId;
47
	protected $voteOptionId;
48
	protected $voteOptionText;
49
	protected $voteAnswer;
50
51
	public function jsonSerialize() {
52
		return [
53
			'id' => $this->id,
54
			'pollId' => $this->pollId,
55
			'userId' => $this->userId,
56
			'voteOptionId' => $this->voteOptionId,
57
			'voteOptionText' => $this->voteOptionText,
58
			'voteAnswer' => $this->voteAnswer
59
		];
60
	}
61
}
62