Completed
Push — master ( 221ac4...66e177 )
by Maxence
9s
created

Circles::detailsCircle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
/**
3
 * Circles - Bring cloud-users closer together.
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Maxence Lange <[email protected]>
9
 * @copyright 2017
10
 * @license GNU AGPL version 3 or any later version
11
 *
12
 * This program is free software: you can redistribute it and/or modify
13
 * it under the terms of the GNU Affero General Public License as
14
 * published by the Free Software Foundation, either version 3 of the
15
 * License, or (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU Affero General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU Affero General Public License
23
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
 *
25
 */
26
27
namespace OCA\Circles\Api;
28
29
30
use OCA\Circles\AppInfo\Application;
31
32
class Circles {
33
34
35
	protected static function getContainer() {
36
		$app = new Application();
37
38
		return $app->getContainer();
39
	}
40
41
	public static function createCircle($type, $name) {
42
		$c = self::getContainer();
43
44
		return $c->query('CirclesService')
45
				 ->createCircle($type, $name);
46
	}
47
48
49
	public static function listCircles($type, $name = '', $level = 0) {
50
		$c = self::getContainer();
51
52
		return $c->query('CirclesService')
53
				 ->listCircles($type, $name, $level);
54
	}
55
56
57
	public static function detailsCircle($circleId) {
58
		$c = self::getContainer();
59
60
		return $c->query('CirclesService')
61
				 ->detailsCircle($circleId);
62
	}
63
64
65
	public static function deleteCircle($circleId) {
66
		$c = self::getContainer();
67
68
		return $c->query('CirclesService')
69
				 ->removeCircle($circleId);
70
	}
71
72
73
	public static function addMember($circleId, $userId) {
74
		$c = self::getContainer();
75
76
		return $c->query('MembersService')
77
				 ->addMember($circleId, $userId);
78
	}
79
80
}