LoadAdditionalScripts   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 13
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 11 3
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Audio Player
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\audioplayer\Listener;
16
17
use OCA\Files\Event\LoadAdditionalScriptsEvent;
0 ignored issues
show
Bug introduced by Rello
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 OCA\Files_Sharing\Event\BeforeTemplateRenderedEvent;
0 ignored issues
show
Bug introduced by Rello
The type OCA\Files_Sharing\Event\...reTemplateRenderedEvent 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...
19
use OCP\EventDispatcher\Event;
20
use OCP\EventDispatcher\IEventListener;
21
use OCP\Util;
22
23
class LoadAdditionalScripts implements IEventListener
24
{
25
    public function handle(Event $event): void
26
    {
27
        if ($event instanceof LoadAdditionalScriptsEvent) {
28
            Util::addScript('audioplayer', 'viewer/viewer');
29
            Util::addStyle('audioplayer', '3rdparty/fontello/css/fontello');
30
        } elseif ($event instanceof BeforeTemplateRenderedEvent) {
31
            Util::addScript('audioplayer', 'viewer/viewer');
32
            Util::addScript('audioplayer', 'sharing/sharing');
33
            Util::addStyle('audioplayer', '3rdparty/fontello/css/fontello');
34
        } else {
35
            return;
36
        }
37
    }
38
}