Completed
Push — master ( 3c00ff...81e983 )
by Joas
10:38 queued 10:11
created

FileChanges::getIcon()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
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\Files\Activity\Filter;
23
24
25
use OCP\Activity\IFilter;
26
use OCP\IL10N;
27
use OCP\IURLGenerator;
28
29
class FileChanges implements IFilter {
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 only identifier
44
	 * @since 11.0.0
45
	 */
46
	public function getIdentifier() {
47
		return 'files';
48
	}
49
50
	/**
51
	 * @return string A translated string
52
	 * @since 11.0.0
53
	 */
54
	public function getName() {
55
		return $this->l->t('File changes');
56
	}
57
58
	/**
59
	 * @return int
60
	 * @since 11.0.0
61
	 */
62
	public function getPriority() {
63
		return 30;
64
	}
65
66
	/**
67
	 * @return string Full URL to an icon, empty string when none is given
68
	 * @since 11.0.0
69
	 */
70
	public function getIcon() {
71
		return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/files-dark.svg'));
72
	}
73
74
	/**
75
	 * @param string[] $types
76
	 * @return string[] An array of allowed apps from which activities should be displayed
77
	 * @since 11.0.0
78
	 */
79
	public function filterTypes(array $types) {
80
		return array_intersect([
81
			'file_created',
82
			'file_changed',
83
			'file_deleted',
84
			'file_restored',
85
		], $types);
86
	}
87
88
	/**
89
	 * @return string[] An array of allowed apps from which activities should be displayed
90
	 * @since 11.0.0
91
	 */
92
	public function allowedApps() {
93
		return ['files'];
94
	}
95
}
96