Completed
Pull Request — master (#2406)
by Joas
27:03
created

Calendar::getIcon()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 3
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 3
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @copyright Copyright (c) 2016 Joas Schilling <[email protected]>
4
 *
5
 * @license GNU AGPL version 3 or any later version
6
 *
7
 * This program is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU Affero General Public License as
9
 * published by the Free Software Foundation, either version 3 of the
10
 * License, or (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU Affero General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Affero General Public License
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 *
20
 */
21
22
namespace OCA\DAV\CalDAV\Activity\Filter;
23
24
25
use OCP\Activity\IFilter;
26
use OCP\IL10N;
27
use OCP\IURLGenerator;
28
29 View Code Duplication
class Calendar implements IFilter {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
31
	/** @var IL10N */
32
	protected $l;
33
34
	/** @var IURLGenerator */
35
	protected $url;
36
37
	public function __construct(IL10N $l, IURLGenerator $url) {
38
		$this->l = $l;
39
		$this->url = $url;
40
	}
41
42
	/**
43
	 * @return string Lowercase a-z and underscore only identifier
44
	 * @since 11.0.0
45
	 */
46
	public function getIdentifier() {
47
		return 'calendar';
48
	}
49
50
	/**
51
	 * @return string A translated string
52
	 * @since 11.0.0
53
	 */
54
	public function getName() {
55
		return $this->l->t('Calendar');
56
	}
57
58
	/**
59
	 * @return int whether the filter should be rather on the top or bottom of
60
	 * the admin section. The filters are arranged in ascending order of the
61
	 * priority values. It is required to return a value between 0 and 100.
62
	 * @since 11.0.0
63
	 */
64
	public function getPriority() {
65
		return 40;
66
	}
67
68
	/**
69
	 * @return string Full URL to an icon, empty string when none is given
70
	 * @since 11.0.0
71
	 */
72
	public function getIcon() {
73
		return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'));
74
	}
75
76
	/**
77
	 * @param string[] $types
78
	 * @return string[] An array of allowed apps from which activities should be displayed
79
	 * @since 11.0.0
80
	 */
81
	public function filterTypes(array $types) {
82
		return array_intersect(['calendar', 'calendar_event'], $types);
83
	}
84
85
	/**
86
	 * @return string[] An array of allowed apps from which activities should be displayed
87
	 * @since 11.0.0
88
	 */
89
	public function allowedApps() {
90
		return [];
91
	}
92
}
93