Completed
Push — master ( 80b27f...d0ec0c )
by Morris
50:16 queued 34:06
created

User   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 36 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 9
loc 25
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getACL() 9 9 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
/**
4
 * @copyright Copyright (c) 2017, Christoph Seitz <[email protected]>
5
 *
6
 * @author Christoph Seitz <[email protected]>
7
 *
8
 * @license GNU AGPL version 3 or any later version
9
 *
10
 * This code is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU Affero General Public License, version 3,
12
 * as published by the Free Software Foundation.
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, version 3,
20
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
21
 *
22
 */
23
24
namespace OCA\DAV\CalDAV\Principal;
25
26
/**
27
 * Class User
28
 *
29
 * @package OCA\DAV\CalDAV\Principal
30
 */
31
class User extends \Sabre\CalDAV\Principal\User {
32
33
	/**
34
	 * Returns a list of ACE's for this node.
35
	 *
36
	 * Each ACE has the following properties:
37
	 *   * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
38
	 *     currently the only supported privileges
39
	 *   * 'principal', a url to the principal who owns the node
40
	 *   * 'protected' (optional), indicating that this ACE is not allowed to
41
	 *      be updated.
42
	 *
43
	 * @return array
44
	 */
45 View Code Duplication
	function getACL() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
46
		$acl = parent::getACL();
47
		$acl[] = [
48
			'privilege' => '{DAV:}read',
49
			'principal' => '{DAV:}authenticated',
50
			'protected' => true,
51
		];
52
		return $acl;
53
	}
54
55
}
56