Passed
Push — master ( e1cb1b...9a76f0 )
by John
15:33 queued 17s
created

PersonalSection   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 69
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getID() 0 2 1
A getPriority() 0 2 1
A __construct() 0 6 1
A getName() 0 2 1
A getIcon() 0 2 1
1
<?php
2
/**
3
 * @copyright Copyright (c) 2018 John Molakvoæ <[email protected]>
4
 *
5
 * @author Christoph Wurst <[email protected]>
6
 * @author John Molakvoæ <[email protected]>
7
 *
8
 * @license GNU AGPL version 3 or any later version
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU Affero General Public License as
12
 * published by the Free Software Foundation, either version 3 of the
13
 * License, or (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
 * GNU Affero General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU Affero General Public License
21
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22
 *
23
 */
24
namespace OCA\Theming\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('Appearance and 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