1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Mood |
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
|
|
|
|
28
|
|
|
namespace OCA\Mood\Service; |
29
|
|
|
|
30
|
|
|
use OCP\IConfig; |
31
|
|
|
|
32
|
|
|
class ConfigService { |
33
|
|
|
|
34
|
|
|
|
35
|
|
|
private $defaults = []; |
|
|
|
|
36
|
|
|
|
37
|
|
|
private $appName; |
38
|
|
|
|
39
|
|
|
private $config; |
40
|
|
|
|
41
|
|
|
private $miscService; |
42
|
|
|
|
43
|
|
|
public function __construct($appName, IConfig $config, $userId, MiscService $miscService) { |
44
|
|
|
$this->appName = $appName; |
45
|
|
|
$this->config = $config; |
46
|
|
|
$this->userId = $userId; |
|
|
|
|
47
|
|
|
$this->miscService = $miscService; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Get a user value by key |
52
|
|
|
* |
53
|
|
|
* @param string $key |
54
|
|
|
* |
55
|
|
|
* @return string |
56
|
|
|
*/ |
57
|
|
|
public function getUserValue($key) { |
58
|
|
|
return $this->config->getUserValue($this->userId, $this->appName, $key); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Set a user value by key |
63
|
|
|
* |
64
|
|
|
* @param string $key |
65
|
|
|
* @param string $value |
66
|
|
|
* |
67
|
|
|
* @return string |
68
|
|
|
*/ |
69
|
|
|
public function setUserValue($key, $value) { |
70
|
|
|
return $this->config->setUserValue($this->userId, $this->appName, $key, $value); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
} |
74
|
|
|
|
This check marks private properties in classes that are never used. Those properties can be removed.