Widget::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Analytics
4
 *
5
 * SPDX-FileCopyrightText: 2019-2022 Marcel Scherello
6
 * SPDX-License-Identifier: AGPL-3.0-or-later
7
 */
8
9
namespace OCA\Analytics\Dashboard;
10
11
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...
12
use OCP\IL10N;
0 ignored issues
show
Bug introduced by
The type OCP\IL10N 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...
13
use OCP\IURLGenerator;
0 ignored issues
show
Bug introduced by
The type OCP\IURLGenerator 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...
14
use OCP\Util;
0 ignored issues
show
Bug introduced by
The type OCP\Util 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
16
class Widget implements IWidget
17
{
18
19
    /** @var IURLGenerator */
20
    private $url;
21
    /** @var IL10N */
22
    private $l10n;
23
24
    public function __construct(
25
        IURLGenerator $url,
26
        IL10N $l10n
27
    )
28
    {
29
        $this->url = $url;
30
        $this->l10n = $l10n;
31
    }
32
33
    /**
34
     * @inheritDoc
35
     */
36
    public function getId(): string
37
    {
38
        return 'analytics';
39
    }
40
41
    /**
42
     * @inheritDoc
43
     */
44
    public function getTitle(): string
45
    {
46
        return $this->l10n->t('Reports');
47
    }
48
49
    /**
50
     * @inheritDoc
51
     */
52
    public function getOrder(): int
53
    {
54
        return 10;
55
    }
56
57
    /**
58
     * @inheritDoc
59
     */
60
    public function getIconClass(): string
61
    {
62
        return 'icon-analytics';
63
    }
64
65
    /**
66
     * @inheritDoc
67
     */
68
    public function getUrl(): ?string
69
    {
70
        return null;
71
    }
72
73
    /**
74
     * @inheritDoc
75
     */
76
    public function load(): void
77
    {
78
        Util::addScript('analytics', 'dashboard');
79
        Util::addScript('analytics', 'visualization');
80
        Util::addStyle('analytics', 'dashboard');
81
        Util::addScript('analytics', '3rdParty/chart.umd');
82
        Util::addScript('analytics', '3rdParty/chartjs-adapter-moment');
83
        Util::addScript('analytics', '3rdParty/moment.min');
84
        Util::addScript('analytics', '3rdParty/cloner');
85
        Util::addScript('analytics', '3rdParty/chartjs-plugin-datalabels.min');
86
    }
87
}