Passed
Push — master ( f9711f...d95d65 )
by Marcel
02:19
created

LoadAdditionalScripts::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Analytics
7
 *
8
 * This file is licensed under the Affero General Public License version 3 or
9
 * later. See the LICENSE.md file.
10
 *
11
 * @author Marcel Scherello <[email protected]>
12
 * @copyright 2020 Marcel Scherello
13
 */
14
15
namespace OCA\Analytics\Listener;
16
17
use OCA\Files\Event\LoadAdditionalScriptsEvent;
0 ignored issues
show
Bug introduced by
The type OCA\Files\Event\LoadAdditionalScriptsEvent was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
use OCP\EventDispatcher\Event;
19
use OCP\EventDispatcher\IEventListener;
20
use OCP\Util;
21
22
class LoadAdditionalScripts implements IEventListener
23
{
24
    public function handle(Event $event): void
25
    {
26
        if (!($event instanceof LoadAdditionalScriptsEvent)) {
27
            return;
28
        }
29
        Util::addScript('analytics', 'viewer');
30
    }
31
}