Application::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @copyright 2020 Morris Jobke <[email protected]>
7
 *
8
 * @author Morris Jobke <[email protected]>
9
 * @author John Molakvoæ <[email protected]>
10
 *
11
 * @license GNU AGPL version 3 or any later version
12
 *
13
 * This program is free software: you can redistribute it and/or modify
14
 * it under the terms of the GNU Affero General Public License as
15
 * published by the Free Software Foundation, either version 3 of the
16
 * License, or (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU Affero General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU Affero General Public License
24
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25
 *
26
 */
27
28
namespace OCA\Files_PDFViewer\AppInfo;
29
30
use OCA\Files_PDFViewer\Listeners\CSPListener;
31
use OCA\Files_PDFViewer\Listeners\LoadViewerListener;
32
use OCA\Viewer\Event\LoadViewer;
33
use OCP\AppFramework\App;
34
use OCP\AppFramework\Bootstrap\IBootContext;
35
use OCP\AppFramework\Bootstrap\IBootstrap;
36
use OCP\AppFramework\Bootstrap\IRegistrationContext;
37
use OCP\Security\CSP\AddContentSecurityPolicyEvent;
38
use OCP\Util;
39
40
class Application extends App implements IBootstrap {
41
	public const APP_ID = 'files_pdfviewer';
42
43
	public function __construct() {
44
		parent::__construct(self::APP_ID);
45
	}
46
47
	public function register(IRegistrationContext $context): void {
48
		$context->registerEventListener(LoadViewer::class, LoadViewerListener::class);
49
		$context->registerEventListener(AddContentSecurityPolicyEvent::class, CSPListener::class);
50
	}
51
52
	public function boot(IBootContext $context): void {
53
		Util::addScript(self::APP_ID, 'files_pdfviewer-public');
54
	}
55
}
56