Passed
Push — master ( 157c65...2ad95f )
by Morris
10:50 queued 10s
created

Application::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @copyright Copyright (c) 2016, ownCloud, Inc.
4
 *
5
 * @author Björn Schießle <[email protected]>
6
 * @author Christoph Wurst <[email protected]>
7
 * @author John Molakvoæ (skjnldsv) <[email protected]>
8
 * @author Maxence Lange <[email protected]>
9
 * @author Morris Jobke <[email protected]>
10
 * @author Robin Appelman <[email protected]>
11
 * @author Roeland Jago Douma <[email protected]>
12
 *
13
 * @license AGPL-3.0
14
 *
15
 * This code is free software: you can redistribute it and/or modify
16
 * it under the terms of the GNU Affero General Public License, version 3,
17
 * as published by the Free Software Foundation.
18
 *
19
 * This program is distributed in the hope that it will be useful,
20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
 * GNU Affero General Public License for more details.
23
 *
24
 * You should have received a copy of the GNU Affero General Public License, version 3,
25
 * along with this program. If not, see <http://www.gnu.org/licenses/>
26
 *
27
 */
28
29
namespace OCA\FederatedFileSharing\AppInfo;
30
31
use OCA\FederatedFileSharing\Listeners\LoadAdditionalScriptsListener;
32
use OCA\FederatedFileSharing\Notifier;
33
use OCA\FederatedFileSharing\OCM\CloudFederationProviderFiles;
34
use OCA\Files\Event\LoadAdditionalScriptsEvent;
35
use OCP\AppFramework\App;
36
use OCP\AppFramework\Bootstrap\IBootContext;
37
use OCP\AppFramework\Bootstrap\IBootstrap;
38
use OCP\AppFramework\Bootstrap\IRegistrationContext;
39
40
class Application extends App implements IBootstrap {
41
	public function __construct() {
42
		parent::__construct('federatedfilesharing');
43
	}
44
45
	public function register(IRegistrationContext $context): void {
46
		$context->registerEventListener(LoadAdditionalScriptsEvent::class, LoadAdditionalScriptsListener::class);
47
	}
48
49
	public function boot(IBootContext $context): void {
50
		$server = $context->getServerContainer();
51
52
		$cloudFederationManager = $server->getCloudFederationProviderManager();
53
		$cloudFederationManager->addCloudFederationProvider('file',
54
			'Federated Files Sharing',
55
			function () use ($server) {
56
				return $server->query(CloudFederationProviderFiles::class);
57
			});
58
59
		$manager = $server->getNotificationManager();
60
		$manager->registerNotifierService(Notifier::class);
61
	}
62
}
63