Completed
Push — master ( 29f5ab...43315e )
by Lukas
08:11
created

Application   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 45
Duplicated Lines 42.22 %

Coupling/Cohesion

Components 0
Dependencies 8

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 19
loc 45
rs 10
c 1
b 0
f 0
wmc 1
lcom 0
cbo 8

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 19 42 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\Core\Controller\OCJSController;
34
use OC\Security\IdentityProof\Manager;
35
use OC\Server;
36
use OCP\AppFramework\App;
37
use OC\Core\Controller\CssController;
38
use OCP\AppFramework\Utility\ITimeFactory;
39
use OCP\IRequest;
40
use OCP\Util;
41
42
/**
43
 * Class Application
44
 *
45
 * @package OC\Core
46
 */
47
class Application extends App {
48
49
	public function __construct() {
50
		parent::__construct('core');
51
52
		$container = $this->getContainer();
53
54
		$container->registerService('defaultMailAddress', function () {
55
			return Util::getDefaultEmailAddress('lostpassword-noreply');
56
		});
57
		$container->registerService(Manager::class, function () {
58
			return new Manager(
59
				\OC::$server->getAppDataDir('identityproof'),
60
				\OC::$server->getCrypto()
61
			);
62
		});
63
		$container->registerService(CssController::class, function () use ($container) {
64
			return new CssController(
65
				$container->query('appName'),
66
				$container->query(IRequest::class),
67
				\OC::$server->getAppDataDir('css'),
68
				$container->query(ITimeFactory::class)
69
			);
70
		});
71 View Code Duplication
		$container->registerService(OCJSController::class, function () use ($container) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
72
			/** @var Server $server */
73
			$server = $container->getServer();
74
			return new OCJSController(
75
				$container->query('appName'),
76
				$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...
77
				$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...
78
				// This is required for the theming to overwrite the `OC_Defaults`, see
79
				// https://github.com/nextcloud/server/issues/3148
80
				$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...
81
				$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...
82
				$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...
83
				$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...
84
				$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...
85
				$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...
86
				$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...
87
				$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...
88
			);
89
		});
90
	}
91
}
92