Completed
Push — master ( fb9cb6...dc5c4b )
by Morris
51:46 queued 21:25
created

Application::__construct()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 32
Code Lines 14

Duplication

Lines 32
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 14
nc 1
nop 1
dl 32
loc 32
rs 8.8571
c 0
b 0
f 0
1
<?php
2
/**
3
 * @copyright Copyright (c) 2016, ownCloud, Inc.
4
 *
5
 * @author Roeland Jago Douma <[email protected]>
6
 * @author Victor Dubiniuk <[email protected]>
7
 *
8
 * @license AGPL-3.0
9
 *
10
 * This code is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU Affero General Public License, version 3,
12
 * as published by the Free Software Foundation.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
 * GNU Affero General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU Affero General Public License, version 3,
20
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
21
 *
22
 */
23
24
namespace OCA\Files_Versions\AppInfo;
25
26
use OCA\DAV\Connector\Sabre\Principal;
27
use OCP\AppFramework\App;
28
use OCA\Files_Versions\Expiration;
29
use OCP\AppFramework\Utility\ITimeFactory;
30
use OCA\Files_Versions\Capabilities;
31
32 View Code Duplication
class Application extends App {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
33
	public function __construct(array $urlParams = array()) {
34
		parent::__construct('files_versions', $urlParams);
35
36
		$container = $this->getContainer();
37
38
		/*
39
		 * Register capabilities
40
		 */
41
		$container->registerCapability(Capabilities::class);
42
43
		/*
44
		 * Register expiration
45
		 */
46
		$container->registerService('Expiration', function($c) {
47
			return  new Expiration(
48
				$c->query('ServerContainer')->getConfig(),
49
				$c->query(ITimeFactory::class)
50
			);
51
		});
52
53
		/*
54
		 * Register $principalBackend for the DAV collection
55
		 */
56
		$container->registerService('principalBackend', function () {
57
			return new Principal(
58
				\OC::$server->getUserManager(),
59
				\OC::$server->getGroupManager(),
60
				\OC::$server->getShareManager(),
61
				\OC::$server->getUserSession()
62
			);
63
		});
64
	}
65
}
66