Completed
Pull Request — master (#115)
by Thomas
03:36
created

Application   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 7

Test Coverage

Coverage 54.55%

Importance

Changes 4
Bugs 0 Features 2
Metric Value
wmc 1
c 4
b 0
f 2
lcom 0
cbo 7
dl 0
loc 63
ccs 24
cts 44
cp 0.5455
rs 10

1 Method

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