Completed
Push — master ( 172550...380074 )
by Sander
10s
created

Notebook   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 34
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A jsonSerialize() 0 11 1
1
<?php
2
/**
3
 * Nextcloud - NextNote
4
 *
5
 * @copyright Copyright (c) 2015, Ben Curtis <[email protected]>
6
 * @copyright Copyright (c) 2017, Sander Brand ([email protected])
7
 * @license GNU AGPL version 3 or any later version
8
 *
9
 * This program is free software: you can redistribute it and/or modify
10
 * it under the terms of the GNU Affero General Public License as
11
 * published by the Free Software Foundation, either version 3 of the
12
 * License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU Affero General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU Affero General Public License
20
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 *
22
 */
23
24
namespace OCA\NextNote\Db;
25
26
use \OCP\AppFramework\Db\Entity;
27
28
/**
29
 * @method integer getId()
30
 * @method void setId(int $value)
31
 * @method integer getParentId()
32
 * @method void setParentId(int $value)
33
 * @method void setUid(string $value)
34
 * @method string getUid()
35
 * @method void setName(string $value)
36
 * @method string getName()
37
 * @method void setGuid(string $value)
38
 * @method string getGuid()
39
 * @method string getColor()
40
 * @method string setColor(string $value)
41
 * @method void setDeleted(integer $value)
42
 * @method integer getDeleted()
43
 * @method void setNoteCount(integer $value)
44
 * @method integer getNoteCount()
45
 */
46
class Notebook extends Entity implements \JsonSerializable {
47
48
	use EntityJSONSerializer;
49
50
	protected $name;
51
	protected $guid;
52
	protected $uid;
53
	protected $parentId;
54
	protected $color;
55
	protected $deleted;
56
	protected $noteCount;
57
58
	public function __construct() {
59
		// add types in constructor
60
		$this->addType('parentId', 'integer');
61
		$this->addType('deleted', 'integer');
62
		$this->addType('note_count', 'integer');
63
	}
64
65
	/**
66
	 * Turns entity attributes into an array
67
	 */
68
	public function jsonSerialize() {
69
		return [
70
			'id' => $this->getId(),
71
			'guid' => $this->getGuid(),
72
			'parent_id' => $this->getParentId(),
73
			'name' => $this->getName(),
74
			'color' => $this->getColor(),
75
			'note_count' => $this->getNoteCount(),
76
			'permissions' => 31
77
		];
78
	}
79
}
80