Completed
Push — master ( 94ab2e...2cd79a )
by Lukas
12:30
created

Application   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 53
Duplicated Lines 35.85 %

Coupling/Cohesion

Components 0
Dependencies 9

Importance

Changes 0
Metric Value
dl 19
loc 53
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 9

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 19 50 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * @copyright Copyright (c) 2016, ownCloud, Inc.
4
 * @copyright Copyright (c) 2016 Joas Schilling <[email protected]>
5
 *
6
 * @author Bernhard Posselt <[email protected]>
7
 * @author Christoph Wurst <[email protected]>
8
 * @author Joas Schilling <[email protected]>
9
 * @author Lukas Reschke <[email protected]>
10
 * @author Morris Jobke <[email protected]>
11
 * @author Roeland Jago Douma <[email protected]>
12
 * @author Thomas Müller <[email protected]>
13
 * @author Victor Dubiniuk <[email protected]>
14
 *
15
 * @license AGPL-3.0
16
 *
17
 * This code is free software: you can redistribute it and/or modify
18
 * it under the terms of the GNU Affero General Public License, version 3,
19
 * as published by the Free Software Foundation.
20
 *
21
 * This program is distributed in the hope that it will be useful,
22
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
 * GNU Affero General Public License for more details.
25
 *
26
 * You should have received a copy of the GNU Affero General Public License, version 3,
27
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
28
 *
29
 */
30
31
namespace OC\Core;
32
33
use OC\AppFramework\Utility\SimpleContainer;
34
use OC\Core\Controller\JsController;
35
use OC\Core\Controller\OCJSController;
36
use OC\Security\IdentityProof\Manager;
37
use OC\Server;
38
use OCP\AppFramework\App;
39
use OC\Core\Controller\CssController;
40
use OCP\AppFramework\Utility\ITimeFactory;
41
use OCP\IRequest;
42
use OCP\Util;
43
44
/**
45
 * Class Application
46
 *
47
 * @package OC\Core
48
 */
49
class Application extends App {
50
51
	public function __construct() {
52
		parent::__construct('core');
53
54
		$container = $this->getContainer();
55
56
		$container->registerService('defaultMailAddress', function () {
57
			return Util::getDefaultEmailAddress('lostpassword-noreply');
58
		});
59
		$container->registerService(Manager::class, function () {
60
			return new Manager(
61
				\OC::$server->getAppDataDir('identityproof'),
62
				\OC::$server->getCrypto()
63
			);
64
		});
65
		$container->registerService(CssController::class, function () use ($container) {
66
			return new CssController(
67
				$container->query('appName'),
68
				$container->query(IRequest::class),
69
				\OC::$server->getAppDataDir('css'),
70
				$container->query(ITimeFactory::class)
71
			);
72
		});
73 View Code Duplication
		$container->registerService(OCJSController::class, function () use ($container) {
74
			/** @var Server $server */
75
			$server = $container->getServer();
76
			return new OCJSController(
77
				$container->query('appName'),
78
				$server->getRequest(),
0 ignored issues
show
Bug introduced by
The method getRequest() does not seem to exist on object<OCA\DAV\Server>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
79
				$server->getL10N('core'),
0 ignored issues
show
Bug introduced by
The method getL10N() does not seem to exist on object<OCA\DAV\Server>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
80
				// This is required for the theming to overwrite the `OC_Defaults`, see
81
				// https://github.com/nextcloud/server/issues/3148
82
				$server->getThemingDefaults(),
0 ignored issues
show
Bug introduced by
The method getThemingDefaults() does not seem to exist on object<OCA\DAV\Server>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
83
				$server->getAppManager(),
0 ignored issues
show
Bug introduced by
The method getAppManager() does not seem to exist on object<OCA\DAV\Server>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
84
				$server->getSession(),
0 ignored issues
show
Bug introduced by
The method getSession() does not seem to exist on object<OCA\DAV\Server>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
85
				$server->getUserSession(),
0 ignored issues
show
Bug introduced by
The method getUserSession() does not seem to exist on object<OCA\DAV\Server>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
86
				$server->getConfig(),
0 ignored issues
show
Bug introduced by
The method getConfig() does not seem to exist on object<OCA\DAV\Server>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
87
				$server->getGroupManager(),
0 ignored issues
show
Bug introduced by
The method getGroupManager() does not seem to exist on object<OCA\DAV\Server>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
88
				$server->getIniWrapper(),
0 ignored issues
show
Bug introduced by
The method getIniWrapper() does not seem to exist on object<OCA\DAV\Server>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
89
				$server->getURLGenerator()
0 ignored issues
show
Bug introduced by
The method getURLGenerator() does not seem to exist on object<OCA\DAV\Server>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
90
			);
91
		});
92
		$container->registerService(JsController::class, function () use ($container) {
93
			return new JsController(
94
				$container->query('AppName'),
95
				$container->query(IRequest::class),
96
				$container->getServer()->getAppDataDir('js'),
97
				$container->query(ITimeFactory::class)
98
			);
99
		});
100
	}
101
}
102