Code Duplication    Length = 66-66 lines in 3 locations

lib/Filter/AllFilter.php 1 location

@@ 29-94 (lines=66) @@
26
use OCP\IL10N;
27
use OCP\IURLGenerator;
28
29
class AllFilter implements IFilter {
30
31
	/** @var IL10N */
32
	protected $l;
33
34
	/** @var IURLGenerator */
35
	protected $url;
36
37
	/**
38
	 * @param IL10N $l
39
	 * @param IURLGenerator $url
40
	 */
41
	public function __construct(IL10N $l, IURLGenerator $url) {
42
		$this->l = $l;
43
		$this->url = $url;
44
	}
45
46
	/**
47
	 * @return string Lowercase a-z only identifier
48
	 * @since 9.2.0
49
	 */
50
	public function getIdentifier() {
51
		return 'all';
52
	}
53
54
	/**
55
	 * @return string A translated string
56
	 * @since 9.2.0
57
	 */
58
	public function getName() {
59
		return $this->l->t('All activities');
60
	}
61
62
	/**
63
	 * @return int
64
	 * @since 9.2.0
65
	 */
66
	public function getPriority() {
67
		return 0;
68
	}
69
70
	/**
71
	 * @return string Full URL to an icon, empty string when none is given
72
	 * @since 9.2.0
73
	 */
74
	public function getIcon() {
75
		return $this->url->getAbsoluteURL($this->url->imagePath('activity', 'activity-dark.svg'));
76
	}
77
78
	/**
79
	 * @param string[] $types
80
	 * @return string[] An array of allowed apps from which activities should be displayed
81
	 * @since 9.2.0
82
	 */
83
	public function filterTypes(array $types) {
84
		return $types;
85
	}
86
87
	/**
88
	 * @return string[] An array of allowed apps from which activities should be displayed
89
	 * @since 9.2.0
90
	 */
91
	public function allowedApps() {
92
		return [];
93
	}
94
}
95

lib/Filter/ByFilter.php 1 location

@@ 29-94 (lines=66) @@
26
use OCP\IL10N;
27
use OCP\IURLGenerator;
28
29
class ByFilter implements IFilter {
30
31
	/** @var IL10N */
32
	protected $l;
33
34
	/** @var IURLGenerator */
35
	protected $url;
36
37
	/**
38
	 * @param IL10N $l
39
	 * @param IURLGenerator $url
40
	 */
41
	public function __construct(IL10N $l, IURLGenerator $url) {
42
		$this->l = $l;
43
		$this->url = $url;
44
	}
45
46
	/**
47
	 * @return string Lowercase a-z only identifier
48
	 * @since 9.2.0
49
	 */
50
	public function getIdentifier() {
51
		return 'by';
52
	}
53
54
	/**
55
	 * @return string A translated string
56
	 * @since 9.2.0
57
	 */
58
	public function getName() {
59
		return $this->l->t('By others');
60
	}
61
62
	/**
63
	 * @return int
64
	 * @since 9.2.0
65
	 */
66
	public function getPriority() {
67
		return 2;
68
	}
69
70
	/**
71
	 * @return string Full URL to an icon, empty string when none is given
72
	 * @since 9.2.0
73
	 */
74
	public function getIcon() {
75
		return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/contacts.svg'));
76
	}
77
78
	/**
79
	 * @param string[] $types
80
	 * @return string[] An array of allowed apps from which activities should be displayed
81
	 * @since 9.2.0
82
	 */
83
	public function filterTypes(array $types) {
84
		return $types;
85
	}
86
87
	/**
88
	 * @return string[] An array of allowed apps from which activities should be displayed
89
	 * @since 9.2.0
90
	 */
91
	public function allowedApps() {
92
		return [];
93
	}
94
}
95

lib/Filter/SelfFilter.php 1 location

@@ 29-94 (lines=66) @@
26
use OCP\IL10N;
27
use OCP\IURLGenerator;
28
29
class SelfFilter implements IFilter {
30
31
	/** @var IL10N */
32
	protected $l;
33
34
	/** @var IURLGenerator */
35
	protected $url;
36
37
	/**
38
	 * @param IL10N $l
39
	 * @param IURLGenerator $url
40
	 */
41
	public function __construct(IL10N $l, IURLGenerator $url) {
42
		$this->l = $l;
43
		$this->url = $url;
44
	}
45
46
	/**
47
	 * @return string Lowercase a-z only identifier
48
	 * @since 9.2.0
49
	 */
50
	public function getIdentifier() {
51
		return 'self';
52
	}
53
54
	/**
55
	 * @return string A translated string
56
	 * @since 9.2.0
57
	 */
58
	public function getName() {
59
		return $this->l->t('By you');
60
	}
61
62
	/**
63
	 * @return int
64
	 * @since 9.2.0
65
	 */
66
	public function getPriority() {
67
		return 1;
68
	}
69
70
	/**
71
	 * @return string Full URL to an icon, empty string when none is given
72
	 * @since 9.2.0
73
	 */
74
	public function getIcon() {
75
		return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/user.svg'));
76
	}
77
78
	/**
79
	 * @param string[] $types
80
	 * @return string[] An array of allowed apps from which activities should be displayed
81
	 * @since 9.2.0
82
	 */
83
	public function filterTypes(array $types) {
84
		return $types;
85
	}
86
87
	/**
88
	 * @return string[] An array of allowed apps from which activities should be displayed
89
	 * @since 9.2.0
90
	 */
91
	public function allowedApps() {
92
		return [];
93
	}
94
}
95