Completed
Push — master ( dfbc21...f148e3 )
by John
64:33 queued 45:49
created

PersonalSection::getID()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @copyright Copyright (c) 2018 John Molakvoæ <[email protected]>
4
 *
5
 * @author John Molakvoæ <[email protected]>
6
 *
7
 * @license GNU AGPL version 3 or any later version
8
 *
9
 * This program is free software: you can redistribute it and/or modify
10
 * it under the terms of the GNU Affero General Public License as
11
 * published by the Free Software Foundation, either version 3 of the
12
 * License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU Affero General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU Affero General Public License
20
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
 *
22
 */
23
24
namespace OCA\Accessibility\Settings;
25
26
use OCP\IL10N;
27
use OCP\IURLGenerator;
28
use OCP\Settings\IIconSection;
29
30
class PersonalSection implements IIconSection {
31
32
	/** @var string */
33
	protected $appName;
34
35
	/** @var IURLGenerator */
36
	private $urlGenerator;
37
38
	/** @var IL10N */
39
	private $l;
40
41
	/**
42
	 * Personal Section constructor.
43
	 *
44
	 * @param string $appName
45
	 * @param IURLGenerator $urlGenerator
46
	 * @param IL10N $l
47
	 */
48
	public function __construct(string $appName,
49
								IURLGenerator $urlGenerator,
50
								IL10N $l) {
51
		$this->appName      = $appName;
52
		$this->urlGenerator = $urlGenerator;
53
		$this->l            = $l;
54
	}
55
56
	/**
57
	 * returns the relative path to an 16*16 icon describing the section.
58
	 * e.g. '/core/img/places/files.svg'
59
	 *
60
	 * @returns string
61
	 * @since 13.0.0
62
	 */
63
	public function getIcon() {
64
		return $this->urlGenerator->imagePath($this->appName, 'app-dark.svg');
65
	}
66
67
	/**
68
	 * returns the ID of the section. It is supposed to be a lower case string,
69
	 * e.g. 'ldap'
70
	 *
71
	 * @returns string
72
	 * @since 9.1
73
	 */
74
	public function getID() {
75
		return $this->appName;
76
	}
77
78
	/**
79
	 * returns the translated name as it should be displayed, e.g. 'LDAP / AD
80
	 * integration'. Use the L10N service to translate it.
81
	 *
82
	 * @return string
83
	 * @since 9.1
84
	 */
85
	public function getName() {
86
		return $this->l->t('Accessibility');
87
	}
88
89
	/**
90
	 * @return int whether the form should be rather on the top or bottom of
91
	 * the settings navigation. The sections are arranged in ascending order of
92
	 * the priority values. It is required to return a value between 0 and 99.
93
	 *
94
	 * E.g.: 70
95
	 * @since 9.1
96
	 */
97
	public function getPriority() {
98
		return 15;
99
	}
100
}
101