Completed
Pull Request — master (#115)
by Thomas
05:40
created

Application   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 7

Test Coverage

Coverage 46.67%

Importance

Changes 6
Bugs 2 Features 2
Metric Value
wmc 1
c 6
b 2
f 2
lcom 0
cbo 7
dl 0
loc 71
ccs 21
cts 45
cp 0.4667
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 65 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\Controller\PageController;
22
use \OCA\Maps\Controller\LocationController;
23
use \OCA\Maps\Controller\FavoriteController;
24
25
26
class Application extends App {
27
28
29 1
	public function __construct (array $urlParams=array()) {
30 1
		parent::__construct('maps', $urlParams);
31
32 1
		$container = $this->getContainer();
33
34
		/**
35
		 * Controllers
36
		 */
37
		$container->registerService('PageController', function($c) {
38
			/** @var SimpleContainer $c */
39 1
			return new PageController(
40 1
				$c->query('AppName'),
41 1
				$c->query('Request'),
42 1
				$c->query('UserId'),
43 1
				$c->query('CacheManager'),
44
				$c->query('DeviceMapper')
45
			);
46 1
		});
47
		$container->registerService('LocationController', function($c) {
48
			/** @var SimpleContainer $c */
49
			return new LocationController(
50
				$c->query('AppName'),
51
				$c->query('Request'),
52
				$c->query('LocationMapper'),
53
				$c->query('DeviceMapper'),
54
				$c->query('UserId')
55
			);
56 1
		});
57
		$container->registerService('FavoriteController', function($c) {
58
			/** @var SimpleContainer $c */
59
			return new FavoriteController(
60
				$c->query('AppName'),
61
				$c->query('Request'),
62
				$c->query('FavoriteMapper'),
63
				$c->query('UserId')
64
			);
65 1
		});
66
67 1
		$server = $container->getServer();
68
		$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...
69
			/** @var SimpleContainer $c */
70 1
			return new CacheManager(
71 1
				$server->getDatabaseConnection()
72 1
			);
73 1
		});
74
		$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...
75
			/** @var SimpleContainer $c */
76
			return new LocationMapper(
77
				$server->getDb()
78
			);
79 1
		});
80
		$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...
81
			/** @var SimpleContainer $c */
82
			return new DeviceMapper(
83
				$server->getDb()
84
			);
85 1
		});
86 1
		$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...
87
			/** @var SimpleContainer $c */
88
			return new FavoriteMapper(
89
				$server->getDb()
90
			);
91 1
		});
92
93 1
	}
94
95
96
}
97