Group   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 17.65%

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 0
dl 0
loc 39
ccs 3
cts 17
cp 0.1765
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A columnToProperty() 0 10 3
A propertyToColumn() 0 10 3
1
<?php
2
declare(strict_types=1);
3
/**
4
 * @copyright Copyright (c) 2019 Joas Schilling <[email protected]>
5
 *
6
 * @license GNU AGPL version 3 or any later version
7
 *
8
 * This program is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Affero General Public License as
10
 * published by the Free Software Foundation, either version 3 of the
11
 * License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU Affero General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Affero General Public License
19
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
 *
21
 */
22
23
namespace OCA\AnnouncementCenter\Model;
24
25
26
use OCP\AppFramework\Db\Entity;
27
28
/**
29
 * @method void setGroup(string $group)
30
 * @method string getGroup()
31
 */
32
class Group extends Entity {
33
34
	/** @var string */
35
	protected $group;
36
37 1
	public function __construct() {
38 1
		$this->addType('group', 'string');
39 1
	}
40
41
	/**
42
	 * @param string $columnName the name of the column
43
	 * @return string the property name
44
	 */
45
	public function columnToProperty($columnName): string {
46
		switch ($columnName) {
47
			case 'announcement_id':
48
				return 'id';
49
			case 'gid':
50
				return 'group';
51
		}
52
53
		return parent::columnToProperty($columnName);
54
	}
55
56
	/**
57
	 * @param string $property the name of the property
58
	 * @return string the column name
59
	 */
60
	public function propertyToColumn($property): string {
61
		switch ($property) {
62
			case 'id':
63
				return 'announcement_id';
64
			case 'group':
65
				return 'gid';
66
		}
67
68
		return parent::propertyToColumn($property);
69
	}
70
}
71