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

Event::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 16
nc 1
nop 0
dl 0
loc 17
ccs 0
cts 16
cp 0
crap 2
rs 9.7333
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(integer $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(string $value)
43
 * @method string getAccess()
44
 * @method void setAccess(string $value)
45
 * @method string getExpire()
46
 * @method void setExpire(string $value)
47
 * @method integer getIsAnonymous()
48
 * @method void setIsAnonymous(integer $value)
49
 * @method integer getFullAnonymous()
50
 * @method void setFullAnonymous(integer $value)
51
 * @method integer getAllowMaybe()
52
 * @method void setAllowMaybe(integer $value)
53
 * @method integer getShowResults()
54
 * @method void setShowResults(integer $value)
55
 * @method integer getVoteLimit()
56
 * @method void setVoteLimit(integer $value)
57
 * @method integer getDeleted()
58
 * @method void setDeleted(integer $value)
59
 * @method integer getDeleteDate()
60
 * @method void setDeleteDate(integer $value)
61
 */
62
class Event extends Entity implements JsonSerializable {
63
	protected $type;
64
	protected $title;
65
	protected $description;
66
	protected $owner;
67
	protected $created;
68
	protected $access;
69
	protected $hash;
70
	protected $expire;
71
	protected $isAnonymous;
72
	protected $fullAnonymous;
73
	protected $allowMaybe;
74
	protected $showResults;
75
	protected $voteLimit;
76
	protected $deleted;
77
	protected $deleteDate;
78
79
	public function jsonSerialize() {
80
		return [
81
			'id' => $this->id,
82
			'type' => $this->type,
83
			'title' => $this->title,
84
			'description' => $this->description,
85
			'owner' => $this->owner,
86
			'created' => $this->created,
87
			'access' => $this->access,
88
			'expire' => $this->expire,
89
			'isAnonymous' => boolval($this->isAnonymous),
90
			'fullAnonymous' => boolval($this->fullAnonymous),
91
			'allowMaybe' => boolval($this->allowMaybe),
92
			'voteLimit' => $this->voteLimit,
93
			'showResults' => $this->showResults,
94
			'deleted' => boolval($this->deleted),
95
			'deleteDate' => $this->deleteDate
96
		];
97
	}
98
}
99