Application   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 8

Test Coverage

Coverage 62%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 8
dl 0
loc 78
ccs 31
cts 50
cp 0.62
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 72 1
1
<?php
2
/**
3
 * ownCloud - maps
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Sander Brand <[email protected]>
9
 * @copyright Sander Brand 2014
10
 */
11
12
namespace OCA\Maps\AppInfo;
13
14
15
use OC\AppFramework\Utility\SimpleContainer;
16
use \OCP\AppFramework\App;
17
use \OCA\Maps\Db\CacheManager;
18
use \OCA\Maps\Db\DeviceMapper;
19
use \OCA\Maps\Db\LocationMapper;
20
use \OCA\Maps\Db\FavoriteMapper;
21
use \OCA\Maps\Db\ApiKeyMapper;
22
use \OCA\Maps\Controller\PageController;
23
use \OCA\Maps\Controller\LocationController;
24
use \OCA\Maps\Controller\FavoriteController;
25
26
27
class Application extends App {
28
29
30 1
	public function __construct (array $urlParams=array()) {
31 1
		parent::__construct('maps', $urlParams);
32
33 1
		$container = $this->getContainer();
34
35
		/**
36
		 * Controllers
37
		 */
38
		$container->registerService('PageController', function($c) {
39
			/** @var SimpleContainer $c */
40 1
			return new PageController(
41 1
				$c->query('AppName'),
42 1
				$c->query('Request'),
43 1
				$c->query('UserId'),
44 1
				$c->query('CacheManager'),
45 1
				$c->query('DeviceMapper'),
46 1
				$c->query('ApiKeyMapper')
47 1
			);
48 1
		});
49
		$container->registerService('LocationController', function($c) {
50
			/** @var SimpleContainer $c */
51
			return new LocationController(
52
				$c->query('AppName'),
53
				$c->query('Request'),
54
				$c->query('LocationMapper'),
55
				$c->query('DeviceMapper'),
56
				$c->query('UserId')
57
			);
58 1
		});
59
		$container->registerService('FavoriteController', function($c) {
60
			/** @var SimpleContainer $c */
61
			return new FavoriteController(
62
				$c->query('AppName'),
63
				$c->query('Request'),
64
				$c->query('FavoriteMapper'),
65
				$c->query('UserId')
66
			);
67 1
		});
68
69 1
		$server = $container->getServer();
70
		$container->registerService('CacheManager', function($c) use ($server) {
0 ignored issues
show
Unused Code introduced by
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
71
			/** @var SimpleContainer $c */
72 1
			return new CacheManager(
73 1
				$server->getDatabaseConnection()
74 1
			);
75 1
		});
76
		$container->registerService('LocationMapper', function($c) use ($server) {
0 ignored issues
show
Unused Code introduced by
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
77
			/** @var SimpleContainer $c */
78
			return new LocationMapper(
79
				$server->getDb()
80
			);
81 1
		});
82
		$container->registerService('DeviceMapper', function($c) use ($server) {
0 ignored issues
show
Unused Code introduced by
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
83
			/** @var SimpleContainer $c */
84 1
			return new DeviceMapper(
85 1
				$server->getDb()
86 1
			);
87 1
		});
88
		$container->registerService('FavoriteMapper', function($c) use ($server) {
0 ignored issues
show
Unused Code introduced by
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
89
			/** @var SimpleContainer $c */
90
			return new FavoriteMapper(
91
				$server->getDb()
92
			);
93 1
		});
94 1
		$container->registerService('ApiKeyMapper', function($c) use ($server) {
0 ignored issues
show
Unused Code introduced by
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
95
			/** @var SimpleContainer $c */
96 1
			return new ApiKeyMapper(
97 1
				$server->getDb()
98 1
			);
99 1
		});
100
101 1
	}
102
103
104
}
105