Filter   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 70
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getIcon() 0 3 1
A getIdentifier() 0 3 1
A filterTypes() 0 3 1
A getName() 0 3 1
A getPriority() 0 3 1
A allowedApps() 0 3 1
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\Activity;
10
11
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...
12
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...
13
14
class Filter implements \OCP\Activity\IFilter
0 ignored issues
show
Bug introduced by
The type OCP\Activity\IFilter 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
17
    private $l10n;
18
    private $urlGenerator;
19
20
    public function __construct(
21
        IL10N $l10n,
22
        IURLGenerator $urlGenerator
23
    )
24
    {
25
        $this->l10n = $l10n;
26
        $this->urlGenerator = $urlGenerator;
27
    }
28
29
    /**
30
     * @return string Lowercase a-z and underscore only identifier
31
     * @since 11.0.0
32
     */
33
    public function getIdentifier()
34
    {
35
        return 'analytics';
36
    }
37
38
    /**
39
     * @return string A translated string
40
     * @since 11.0.0
41
     */
42
    public function getName()
43
    {
44
        return $this->l10n->t('Analytics');
45
    }
46
47
    /**
48
     * @return int whether the filter should be rather on the top or bottom of
49
     * the admin section. The filters are arranged in ascending order of the
50
     * priority values. It is required to return a value between 0 and 100.
51
     * @since 11.0.0
52
     */
53
    public function getPriority()
54
    {
55
        return 90;
56
    }
57
58
    /**
59
     * @return string Full URL to an icon, empty string when none is given
60
     * @since 11.0.0
61
     */
62
    public function getIcon()
63
    {
64
        return $this->urlGenerator->imagePath('analytics', 'app-dark.svg');
65
    }
66
67
    /**
68
     * @param string[] $types
69
     * @return string[] An array of allowed apps from which activities should be displayed
70
     * @since 11.0.0
71
     */
72
    public function filterTypes(array $types)
73
    {
74
        return array_merge($types, ['analytics_report'], ['analytics_dataset'], ['analytics_panorama']);
75
    }
76
77
    /**
78
     * @return string[] An array of allowed apps from which activities should be displayed
79
     * @since 11.0.0
80
     */
81
    public function allowedApps()
82
    {
83
        return ['analytics'];
84
    }
85
}
86
87