Passed
Push — master ( f81721...6db32d )
by Marcel
05:08
created

Widget   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 64
rs 10
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getTitle() 0 3 1
A getOrder() 0 3 1
A getUrl() 0 3 1
A getIconClass() 0 3 1
A __construct() 0 7 1
A load() 0 4 1
A getId() 0 3 1
1
<?php
2
/**
3
 * Audio Player
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the LICENSE.md file.
7
 *
8
 * @author Marcel Scherello <[email protected]>
9
 * @copyright 2021 Marcel Scherello
10
 */
11
12
namespace OCA\audioplayer\Dashboard;
13
14
use OCP\Dashboard\IWidget;
0 ignored issues
show
Bug introduced by
The type OCP\Dashboard\IWidget 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...
15
use OCP\IL10N;
16
use OCP\IURLGenerator;
17
use OCP\Util;
18
19
class Widget implements IWidget
20
{
21
22
    /** @var IURLGenerator */
23
    private $url;
24
    /** @var IL10N */
25
    private $l10n;
26
27
    public function __construct(
28
        IURLGenerator $url,
29
        IL10N $l10n
30
    )
31
    {
32
        $this->url = $url;
33
        $this->l10n = $l10n;
34
    }
35
36
    /**
37
     * @inheritDoc
38
     */
39
    public function getId(): string
40
    {
41
        return 'audioplayer';
42
    }
43
44
    /**
45
     * @inheritDoc
46
     */
47
    public function getTitle(): string
48
    {
49
        return $this->l10n->t('Audio Player');
50
    }
51
52
    /**
53
     * @inheritDoc
54
     */
55
    public function getOrder(): int
56
    {
57
        return 10;
58
    }
59
60
    /**
61
     * @inheritDoc
62
     */
63
    public function getIconClass(): string
64
    {
65
        return 'icon-audioplayer';
66
    }
67
68
    /**
69
     * @inheritDoc
70
     */
71
    public function getUrl(): ?string
72
    {
73
        return null;
74
    }
75
76
    /**
77
     * @inheritDoc
78
     */
79
    public function load(): void
80
    {
81
        Util::addScript('audioplayer', 'dashboard');
82
        Util::addStyle('audioplayer', 'dashboard');
83
    }
84
}