Passed
Branch master (7b1276)
by Marcel
06:24
created

Filter::getIdentifier()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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