Completed
Push — master ( 3954d5...05f19f )
by Maxence
03:27
created

SettingsController::admin()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 3
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace OCA\Circles\Controller;
4
5
use OCA\Circles\Service\ConfigService;
6
use OCA\Circles\Service\MiscService;
7
use OCP\AppFramework\Controller;
8
use OCP\AppFramework\Http\TemplateResponse;
9
use OCP\IRequest;
10
11
12
class SettingsController extends Controller {
13
14
	/** @var ConfigService */
15
	private $configService;
16
17
	/** @var MiscService */
18
	private $miscService;
19
20
	public function __construct(
21
		$appName, IRequest $request, ConfigService $configService, MiscService $miscService
22
	) {
23
		parent::__construct($appName, $request);
24
		$this->configService = $configService;
25
		$this->miscService = $miscService;
26
	}
27
28
	/**
29
	 * @NoCSRFRequired
30
	 */
31
	public function admin() {
32
		return new TemplateResponse($this->appName, 'settings.admin', [], 'blank');
33
	}
34
35
36
	public function getSettings() {
37
		$params = [
38
			'allowFederatedCircles' => $this->configService->getAppValue(
39
				ConfigService::CIRCLES_ALLOW_FEDERATED
40
			)
41
		];
42
43
		return $params;
44
	}
45
46
47
	public function setSettings($allow_federated_circles) {
0 ignored issues
show
Coding Style Naming introduced by
The parameter $allow_federated_circles is not named in camelCase.

This check marks parameter names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
48
		$this->configService->setAppValue(
49
			ConfigService::CIRCLES_ALLOW_FEDERATED, $allow_federated_circles
50
		);
51
52
		return $this->getSettings();
53
	}
54
}