Completed
Push — master ( 862cae...854c71 )
by Raimund
13s
created

Application   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A registerNavigation() 0 19 1
1
<?php
2
/**
3
 * Nextcloud - Tasks
4
 *
5
 * @author Raimund Schlüßler
6
 * @copyright 2019 Raimund Schlüßler <[email protected]>
7
 *
8
 * This library is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
10
 * License as published by the Free Software Foundation; either
11
 * version 3 of the License, or any later version.
12
 *
13
 * This library is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
17
 *
18
 * You should have received a copy of the GNU Affero General Public
19
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
20
 *
21
 */
22
23
namespace OCA\Tasks\AppInfo;
24
25
use OCP\AppFramework\App;
26
27
class Application extends App {
28
29
	/**
30
	 * @param array $params
31
	 */
32
	public function __construct(array $params=[]) {
33
		parent::__construct('tasks', $params);
34
	}
35
36
	/**
37
	 * Register navigation
38
	 */
39
	public function registerNavigation() {
40
		$appName = $this->getContainer()->getAppName();
41
		$server = $this->getContainer()->getServer();
42
		$urlGenerator = $server->getURLGenerator();
43
44
		$server->getNavigationManager()->add(function() use ($appName, $server, $urlGenerator) {
45
			return [
46
				'id' => $appName,
47
48
				'order' => 100,
49
50
				'href' => $urlGenerator->linkToRoute('tasks.page.index'),
51
52
				'icon' => $urlGenerator->imagePath($appName, 'tasks.svg'),
53
54
				'name' => $server->getL10N($appName)->t('Tasks'),
55
			];
56
		});
57
	}
58
}
59