Application   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 16
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A register() 0 4 1
A boot() 0 3 1
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