AddressBookRoot   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 19
ccs 0
cts 3
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getChildForPrincipal() 0 5 1
1
<?php
2
/**
3
 * ownCloud - Addressbook
4
 *
5
 * @author Thomas Tanghus
6
 * @copyright 2012-2014 Thomas Tanghus ([email protected])
7
 *
8
 * This library is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
10
 * License as published by the Free Software Foundation; either
11
 * version 3 of the License, or any later version.
12
 *
13
 * This library 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
19
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
20
 *
21
 */
22
23
namespace OCA\Contacts\CardDAV;
24
25
/**
26
 * This class overrides \Sabre\CardDAV\AddressBookRoot::getChildForPrincipal()
27
 * to instantiate OC_Connector_CardDAV_UserAddressBooks.
28
*/
29
class AddressBookRoot extends \Sabre\CardDAV\AddressBookRoot {
30
31
	/**
32
	* This method returns a node for a principal.
33
	*
34
	* The passed array contains principal information, and is guaranteed to
35
	* at least contain a uri item. Other properties may or may not be
36
	* supplied by the authentication backend.
37
	*
38
	* @param array $principal
39
	* @return \Sabre\DAV\INode
40
	*/
41
	public function getChildForPrincipal(array $principal) {
42
43
		return new UserAddressBooks($this->carddavBackend, $principal['uri']);
44
45
	}
46
47
}
48