Completed
Push — master ( 1990ee...212490 )
by Maxence
04:38 queued 01:45
created

ShotgunCircles::getContainer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
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\v1;
28
29
30
use OCA\Circles\AppInfo\Application;
31
use OCA\Circles\Exceptions\ApiVersionIncompatibleException;
32
use OCA\Circles\Model\Circle;
33
use OCA\Circles\Model\FederatedLink;
34
use OCA\Circles\Model\Member;
35
use OCA\Circles\Model\SharingFrame;
36
use OCA\Circles\Service\CirclesService;
37
use OCA\Circles\Service\FederatedLinkService;
38
use OCA\Circles\Service\MembersService;
39
use OCA\Circles\Service\MiscService;
40
use OCA\Circles\Service\SharingFrameService;
41
use OCP\Util;
42
43
/**
44
 * Better use the other one.
45
 *
46
 * This is a shotgun class; don't blow your foot.
47
 */
48
class ShotgunCircles {
49
50
	protected static function getContainer() {
51
		$app = new Application();
52
53
		return $app->getContainer();
54
	}
55
56
57
	/**
58
	 * ShotgunCircles::getSharesFromCircle();
59
	 *
60
	 * This function will returns all item (array) shared to a specific circle identified by its Id,
61
	 * source and type.
62
	 *
63
	 * Warning - please use Circles::getSharesFromCircle for any interaction with the current user
64
	 * session.
65
	 *
66
	 * @param string $circleUniqueId
67
	 * @param string $userId
68
	 *
69
	 * @return SharingFrame[]
70
	 */
71
	public static function getSharesFromCircle($circleUniqueId, $userId = '') {
72
		$c = self::getContainer();
73
74
		return $c->query(SharingFrameService::class)
75
				 ->forceGetFrameFromCircle($circleUniqueId, $userId);
76
	}
77
78
79
}