Completed
Push — master ( 996e9e...ba6656 )
by Roeland
09:11 queued 11s
created

AppConfig::setUserValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 2
1
<?php
2
/**
3
 * ownCloud - Richdocuments App
4
 *
5
 * @author Victor Dubiniuk
6
 * @copyright 2015 Victor Dubiniuk [email protected]
7
 *
8
 * This file is licensed under the Affero General Public License version 3 or
9
 * later.
10
 */
11
12
namespace OCA\Richdocuments;
13
14
use OCA\Richdocuments\AppInfo\Application;
15
use \OCP\IConfig;
16
17
class AppConfig{
18
	private $defaults = [
19
		'wopi_url' => 'https://localhost:9980'
20
	];
21
22
	/** @var IConfig */
23
	private $config;
24
25
	public function __construct(IConfig $config) {
26
		$this->config = $config;
27
	}
28
29
	/**
30
	 * Get a value by key
31
	 * @param string $key
32
	 * @return string
33
	 */
34
	public function getAppValue($key) {
35
		$defaultValue = null;
36
		if (array_key_exists($key, $this->defaults)){
37
			$defaultValue = $this->defaults[$key];
38
		}
39
		return $this->config->getAppValue(Application::APPNAME, $key, $defaultValue);
40
	}
41
42
	/**
43
	 * Set a value by key
44
	 * @param string $key
45
	 * @param string $value
46
	 * @return void
47
	 */
48
	public function setAppValue($key, $value) {
49
		$this->config->setAppValue(Application::APPNAME, $key, $value);
50
	}
51
 }
52