1 | <?php |
||
38 | class ConfigService { |
||
39 | |||
40 | const BOOKMARKS_TTL = 'bookmarks_ttl'; |
||
41 | |||
42 | public $defaults = [ |
||
43 | self::BOOKMARKS_TTL => '5' |
||
44 | ]; |
||
45 | |||
46 | |||
47 | /** @var IConfig */ |
||
48 | private $config; |
||
49 | |||
50 | /** @var string */ |
||
51 | private $userId; |
||
52 | |||
53 | /** @var MiscService */ |
||
54 | private $miscService; |
||
55 | |||
56 | |||
57 | /** |
||
58 | * ConfigService constructor. |
||
59 | * |
||
60 | * @param IConfig $config |
||
61 | * @param string $userId |
||
62 | * @param MiscService $miscService |
||
63 | */ |
||
64 | public function __construct(IConfig $config, $userId, MiscService $miscService) { |
||
69 | |||
70 | |||
71 | /** |
||
72 | * @return array |
||
73 | */ |
||
74 | public function getConfig(): array { |
||
84 | |||
85 | |||
86 | /** |
||
87 | * @param array $save |
||
88 | */ |
||
89 | public function setConfig(array $save) { |
||
98 | |||
99 | |||
100 | /** |
||
101 | * Get a value by key |
||
102 | * |
||
103 | * @param string $key |
||
104 | * |
||
105 | * @return string |
||
106 | */ |
||
107 | public function getAppValue(string $key): string { |
||
115 | |||
116 | |||
117 | /** |
||
118 | * Set a value by key |
||
119 | * |
||
120 | * @param string $key |
||
121 | * @param string $value |
||
122 | */ |
||
123 | public function setAppValue(string $key, string $value) { |
||
126 | |||
127 | |||
128 | /** |
||
129 | * remove a key |
||
130 | * |
||
131 | * @param string $key |
||
132 | */ |
||
133 | public function deleteAppValue(string $key) { |
||
136 | |||
137 | |||
138 | /** |
||
139 | * return if option is enabled. |
||
140 | * |
||
141 | * @param $key |
||
142 | * |
||
143 | * @return bool |
||
144 | */ |
||
145 | public function optionIsSelected($key): bool { |
||
148 | |||
149 | } |
||
150 | |||
151 |