UserAddressBooks   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getChildren() 0 10 2
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\UserAddressBooks::getChildren()
27
 * to instantiate \OCA\Contacts\CardDAV\AddressBooks.
28
*/
29
class UserAddressBooks extends \Sabre\CardDAV\UserAddressBooks {
30
31
	/**
32
	* Returns a list of addressbooks
33
	*
34
	* @return array
35
	*/
36
	public function getChildren() {
37
38
		$addressbooks = $this->carddavBackend->getAddressbooksForUser($this->principalUri);
39
		$objs = array();
40
		foreach($addressbooks as $addressbook) {
41
			$objs[] = new AddressBook($this->carddavBackend, $addressbook);
42
		}
43
		return $objs;
44
45
	}
46
47
}
48