Passed
Push — master ( 6d21e0...1f4c02 )
by Morris
14:24 queued 10s
created

Application::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @copyright Copyright (c) 2020, Julien Veyssier
7
 *
8
 * @author Julien Veyssier <[email protected]>
9
 *
10
 * @license AGPL-3.0
11
 *
12
 * This code is free software: you can redistribute it and/or modify
13
 * it under the terms of the GNU Affero General Public License, version 3,
14
 * as published by the Free Software Foundation.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
 * GNU Affero General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU Affero General Public License, version 3,
22
 * along with this program. If not, see <http://www.gnu.org/licenses/>
23
 *
24
 */
25
26
namespace OCA\WeatherStatus\AppInfo;
27
28
use OCA\WeatherStatus\Capabilities;
29
use OCP\AppFramework\App;
30
use OCP\AppFramework\Bootstrap\IBootContext;
31
use OCP\AppFramework\Bootstrap\IBootstrap;
32
use OCP\AppFramework\Bootstrap\IRegistrationContext;
33
use OCP\Dashboard\RegisterWidgetEvent;
34
use OCP\EventDispatcher\IEventDispatcher;
35
use OCP\EventDispatcher\Event;
36
use OCP\Util;
37
38
/**
39
 * Class Application
40
 *
41
 * @package OCA\WeatherStatus\AppInfo
42
 */
43
class Application extends App implements IBootstrap {
44
45
	/** @var string */
46
	public const APP_ID = 'weather_status';
47
48
	/**
49
	 * Application constructor.
50
	 *
51
	 * @param array $urlParams
52
	 */
53
	public function __construct(array $urlParams = []) {
54
		parent::__construct(self::APP_ID, $urlParams);
55
56
		$dispatcher = $this->getContainer()->query(IEventDispatcher::class);
57
		$dispatcher->addListener(RegisterWidgetEvent::class, function (Event $e) {
0 ignored issues
show
Unused Code introduced by
The parameter $e is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

57
		$dispatcher->addListener(RegisterWidgetEvent::class, function (/** @scrutinizer ignore-unused */ Event $e) {

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

Loading history...
58
			Util::addScript(self::APP_ID, 'weather-status');
59
		});
60
	}
61
62
	/**
63
	 * @inheritDoc
64
	 */
65
	public function register(IRegistrationContext $context): void {
66
		// Register OCS Capabilities
67
		$context->registerCapability(Capabilities::class);
68
	}
69
70
	public function boot(IBootContext $context): void {
71
	}
72
}
73