Passed
Push — master ( ecb34d...b8eee1 )
by Maxence
02:13
created

Admin   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
dl 0
loc 47
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getForm() 0 9 1
A getSection() 0 2 1
A __construct() 0 3 1
A getPriority() 0 2 1
1
<?php
2
/**
3
 * CMS Pico - Integration of Pico within your files to create websites.
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Maxence Lange <[email protected]>
9
 * @copyright 2017
10
 * @license GNU AGPL version 3 or any later version
11
 *
12
 * This program is free software: you can redistribute it and/or modify
13
 * it under the terms of the GNU Affero General Public License as
14
 * published by the Free Software Foundation, either version 3 of the
15
 * License, or (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU Affero General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU Affero General Public License
23
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
 *
25
 */
26
27
namespace OCA\CMSPico\Settings;
28
29
use OCA\CMSPico\AppInfo\Application;
30
use OCP\AppFramework\Http\TemplateResponse;
31
use OCP\IL10N;
32
use OCP\IURLGenerator;
33
use OCP\Settings\ISettings;
0 ignored issues
show
Bug introduced by
The type OCP\Settings\ISettings was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
34
35
class Admin implements ISettings {
36
37
	/** @var IL10N */
38
	private $l10n;
39
40
	/** @var IURLGenerator */
41
	private $urlGenerator;
42
43
	/**
44
	 * @param IL10N $l10n
45
	 * @param IURLGenerator $urlGenerator
46
	 */
47
	public function __construct(IL10N $l10n, IURLGenerator $urlGenerator) {
48
		$this->l10n = $l10n;
49
		$this->urlGenerator = $urlGenerator;
50
	}
51
52
	/**
53
	 * @return TemplateResponse
54
	 */
55
	public function getForm() {
56
		$data = [
57
			'nchost'      => $this->urlGenerator->getBaseUrl(),
58
			'ssl_enabled' => (substr($this->urlGenerator->getBaseUrl(), 0, 5) === 'https')
59
		];
60
61
		\OC::$server->getLogger()->log(4, '______ ADMIN');
62
63
		return new TemplateResponse(Application::APP_NAME, 'settings.admin', $data);
64
	}
65
66
	/**
67
	 * @return string the section ID, e.g. 'sharing'
68
	 */
69
	public function getSection() {
70
		return Application::APP_NAME;
71
	}
72
73
	/**
74
	 * @return int whether the form should be rather on the top or bottom of
75
	 * the admin section. The forms are arranged in ascending order of the
76
	 * priority values. It is required to return a value between 0 and 100.
77
	 *
78
	 * keep the server setting at the top, right after "server settings"
79
	 */
80
	public function getPriority() {
81
		return 0;
82
	}
83
84
}
85