Completed
Push — master ( 527ecb...217492 )
by René
04:32
created

Poll::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 18
nc 1
nop 0
dl 0
loc 19
ccs 0
cts 18
cp 0
crap 2
rs 9.6666
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 getType()
34
 * @method void setType(string $value)
35
 * @method string getTitle()
36
 * @method void setTitle(string $value)
37
 * @method string getDescription()
38
 * @method void setDescription(string $value)
39
 * @method string getOwner()
40
 * @method void setOwner(string $value)
41
 * @method string getCreated()
42
 * @method void setCreated(integer $value)
43
 * @method string getExpire()
44
 * @method void setExpire(integer $value)
45
 * @method integer getDeleted()
46
 * @method void setDeleted(integer $value)
47
 * @method string getAccess()
48
 * @method void setAccess(string $value)
49
 * @method integer getAnonymous()
50
 * @method void setAnonymous(integer $value)
51
 * @method integer getFullAnonymous()
52
 * @method void setFullAnonymous(integer $value)
53
 * @method integer getAllowMaybe()
54
 * @method void setAllowMaybe(integer $value)
55
 * @method integer getOptions()
56
 * @method void setOptions(string $value)
57
 * @method integer getSettings()
58
 * @method void setSettings(string $value)
59
 * @method integer getVoteLimit()
60
 * @method void setVoteLimit(integer $value)
61
 * @method integer getShowResults()
62
 * @method void setShowResults(string $value)
63
 * @method integer getAdminAccess()
64
 * @method void setAdminAccess(integer $value)
65
 */
66
class Poll extends Entity implements JsonSerializable {
67
68
	/** @var string $type */
69
	protected $type;
70
71
	/** @var string $title */
72
	protected $title;
73
74
	/** @var string $description */
75
	protected $description;
76
77
	/** @var string $owner */
78
	protected $owner;
79
80
	/** @var int $created */
81
	protected $created;
82
83
	/** @var int $expire */
84
	protected $expire;
85
86
	/** @var int $deleted */
87
	protected $deleted;
88
89
	/** @var string $access */
90
	protected $access;
91
92
	/** @var int $anonymous */
93
	protected $anonymous;
94
95
	/** @var int $fullAnonymous */
96
	protected $fullAnonymous;
97
98
	/** @var int $allowMaybe */
99
	protected $allowMaybe;
100
101
	/** @var string $options */
102
	protected $options;
103
104
	/** @var string $settings*/
105
	protected $settings;
106
107
	/** @var int $voteLimit*/
108
	protected $voteLimit;
109
110
	/** @var string $showResults */
111
	protected $showResults;
112
113
	/** @var int $adminAccess*/
114
	protected $adminAccess;
115
116
	public function jsonSerialize() {
117
		return [
118
			'id' => intval($this->id),
119
			'type' => $this->type,
120
			'title' => $this->title,
121
			'description' => $this->description,
122
			'owner' => $this->owner,
123
			'created' => intval($this->created),
124
			'expire' => intval($this->expire),
125
			'deleted' => intval($this->deleted),
126
			'access' => $this->access,
127
			'anonymous' => intval($this->anonymous),
128
			'fullAnonymous' => intval($this->fullAnonymous),
129
			'allowMaybe' => intval($this->allowMaybe),
130
			'options' => $this->options,
131
			'settings' => $this->settings,
132
			'voteLimit' => intval($this->voteLimit),
133
			'showResults' => $this->showResults,
134
			'adminAccess' => $this->adminAccess
135
		];
136
	}
137
}
138