Passed
Pull Request — master (#548)
by René
04:19
created

Comment   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 37.5%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 19
ccs 3
cts 8
cp 0.375
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A read() 0 6 1
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 OCP\AppFramework\Db\Entity;
29
30
/**
31
 * @method string getUserId()
32
 * @method void setUserId(string $value)
33
 * @method string getDt()
34
 * @method void setDt(string $value)
35
 * @method string getComment()
36
 * @method void setComment(string $value)
37
 * @method integer getPollId()
38
 * @method void setPollId(integer $value)
39
 */
40
class Comment extends Model {
41
	protected $userId;
42
	protected $dt;
43
	protected $comment;
44
	protected $pollId;
45
46
	/**
47
	 * Comment constructor.
48
	 */
49 1
	public function __construct() {
50 1
		$this->addType('pollId', 'integer');
51 1
	}
52
53
	public function read() {
54
		return [
55
			'id' => $this->getId(),
56
			'userId' => $this->getUserId(),
57
			'date' => $this->getDt() . ' UTC',
58
			'comment' => $this->getComment()
59
		];
60
61
	}
62
}
63