Completed
Push — master ( d0a5ee...b8b229 )
by John
40:50 queued 14s
created
lib/private/AppFramework/Services/AppConfig.php 1 patch
Indentation   +307 added lines, -307 removed lines patch added patch discarded remove patch
@@ -16,334 +16,334 @@
 block discarded – undo
16 16
 use OCP\IConfig;
17 17
 
18 18
 class AppConfig implements IAppConfig {
19
-	public function __construct(
20
-		private IConfig $config,
21
-		/** @var \OC\AppConfig */
22
-		private \OCP\IAppConfig $appConfig,
23
-		private string $appName,
24
-	) {
25
-	}
19
+    public function __construct(
20
+        private IConfig $config,
21
+        /** @var \OC\AppConfig */
22
+        private \OCP\IAppConfig $appConfig,
23
+        private string $appName,
24
+    ) {
25
+    }
26 26
 
27
-	/**
28
-	 * @inheritDoc
29
-	 *
30
-	 * @return string[] list of stored config keys
31
-	 * @since 20.0.0
32
-	 */
33
-	public function getAppKeys(): array {
34
-		return $this->appConfig->getKeys($this->appName);
35
-	}
27
+    /**
28
+     * @inheritDoc
29
+     *
30
+     * @return string[] list of stored config keys
31
+     * @since 20.0.0
32
+     */
33
+    public function getAppKeys(): array {
34
+        return $this->appConfig->getKeys($this->appName);
35
+    }
36 36
 
37
-	/**
38
-	 * @inheritDoc
39
-	 *
40
-	 * @param string $key config key
41
-	 * @param bool|null $lazy TRUE to search within lazy loaded config, NULL to search within all config
42
-	 *
43
-	 * @return bool TRUE if key exists
44
-	 * @since 29.0.0
45
-	 */
46
-	public function hasAppKey(string $key, ?bool $lazy = false): bool {
47
-		return $this->appConfig->hasKey($this->appName, $key, $lazy);
48
-	}
37
+    /**
38
+     * @inheritDoc
39
+     *
40
+     * @param string $key config key
41
+     * @param bool|null $lazy TRUE to search within lazy loaded config, NULL to search within all config
42
+     *
43
+     * @return bool TRUE if key exists
44
+     * @since 29.0.0
45
+     */
46
+    public function hasAppKey(string $key, ?bool $lazy = false): bool {
47
+        return $this->appConfig->hasKey($this->appName, $key, $lazy);
48
+    }
49 49
 
50
-	/**
51
-	 * @param string $key config key
52
-	 * @param bool|null $lazy TRUE to search within lazy loaded config, NULL to search within all config
53
-	 *
54
-	 * @return bool
55
-	 * @throws AppConfigUnknownKeyException if config key is not known
56
-	 * @since 29.0.0
57
-	 */
58
-	public function isSensitive(string $key, ?bool $lazy = false): bool {
59
-		return $this->appConfig->isSensitive($this->appName, $key, $lazy);
60
-	}
50
+    /**
51
+     * @param string $key config key
52
+     * @param bool|null $lazy TRUE to search within lazy loaded config, NULL to search within all config
53
+     *
54
+     * @return bool
55
+     * @throws AppConfigUnknownKeyException if config key is not known
56
+     * @since 29.0.0
57
+     */
58
+    public function isSensitive(string $key, ?bool $lazy = false): bool {
59
+        return $this->appConfig->isSensitive($this->appName, $key, $lazy);
60
+    }
61 61
 
62
-	/**
63
-	 * @inheritDoc
64
-	 *
65
-	 * @param string $key config key
66
-	 *
67
-	 * @return bool TRUE if config is lazy loaded
68
-	 * @throws AppConfigUnknownKeyException if config key is not known
69
-	 * @see \OCP\IAppConfig for details about lazy loading
70
-	 * @since 29.0.0
71
-	 */
72
-	public function isLazy(string $key): bool {
73
-		return $this->appConfig->isLazy($this->appName, $key);
74
-	}
62
+    /**
63
+     * @inheritDoc
64
+     *
65
+     * @param string $key config key
66
+     *
67
+     * @return bool TRUE if config is lazy loaded
68
+     * @throws AppConfigUnknownKeyException if config key is not known
69
+     * @see \OCP\IAppConfig for details about lazy loading
70
+     * @since 29.0.0
71
+     */
72
+    public function isLazy(string $key): bool {
73
+        return $this->appConfig->isLazy($this->appName, $key);
74
+    }
75 75
 
76
-	/**
77
-	 * @inheritDoc
78
-	 *
79
-	 * @param string $key config keys prefix to search
80
-	 * @param bool $filtered TRUE to hide sensitive config values. Value are replaced by {@see IConfig::SENSITIVE_VALUE}
81
-	 *
82
-	 * @return array<string, string|int|float|bool|array> [configKey => configValue]
83
-	 * @since 29.0.0
84
-	 */
85
-	public function getAllAppValues(string $key = '', bool $filtered = false): array {
86
-		return $this->appConfig->getAllValues($this->appName, $key, $filtered);
87
-	}
76
+    /**
77
+     * @inheritDoc
78
+     *
79
+     * @param string $key config keys prefix to search
80
+     * @param bool $filtered TRUE to hide sensitive config values. Value are replaced by {@see IConfig::SENSITIVE_VALUE}
81
+     *
82
+     * @return array<string, string|int|float|bool|array> [configKey => configValue]
83
+     * @since 29.0.0
84
+     */
85
+    public function getAllAppValues(string $key = '', bool $filtered = false): array {
86
+        return $this->appConfig->getAllValues($this->appName, $key, $filtered);
87
+    }
88 88
 
89
-	/**
90
-	 * @inheritDoc
91
-	 *
92
-	 * @param string $key the key of the value, under which will be saved
93
-	 * @param string $value the value that should be stored
94
-	 * @since 20.0.0
95
-	 * @deprecated 29.0.0 use {@see setAppValueString()}
96
-	 */
97
-	public function setAppValue(string $key, string $value): void {
98
-		/** @psalm-suppress InternalMethod */
99
-		$this->appConfig->setValueMixed($this->appName, $key, $value);
100
-	}
89
+    /**
90
+     * @inheritDoc
91
+     *
92
+     * @param string $key the key of the value, under which will be saved
93
+     * @param string $value the value that should be stored
94
+     * @since 20.0.0
95
+     * @deprecated 29.0.0 use {@see setAppValueString()}
96
+     */
97
+    public function setAppValue(string $key, string $value): void {
98
+        /** @psalm-suppress InternalMethod */
99
+        $this->appConfig->setValueMixed($this->appName, $key, $value);
100
+    }
101 101
 
102
-	/**
103
-	 * @inheritDoc
104
-	 *
105
-	 * @param string $key config key
106
-	 * @param string $value config value
107
-	 * @param bool $lazy set config as lazy loaded
108
-	 * @param bool $sensitive if TRUE value will be hidden when listing config values.
109
-	 *
110
-	 * @return bool TRUE if value was different, therefor updated in database
111
-	 * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
112
-	 * @since 29.0.0
113
-	 * @see \OCP\IAppConfig for explanation about lazy loading
114
-	 */
115
-	public function setAppValueString(
116
-		string $key,
117
-		string $value,
118
-		bool $lazy = false,
119
-		bool $sensitive = false,
120
-	): bool {
121
-		return $this->appConfig->setValueString($this->appName, $key, $value, $lazy, $sensitive);
122
-	}
102
+    /**
103
+     * @inheritDoc
104
+     *
105
+     * @param string $key config key
106
+     * @param string $value config value
107
+     * @param bool $lazy set config as lazy loaded
108
+     * @param bool $sensitive if TRUE value will be hidden when listing config values.
109
+     *
110
+     * @return bool TRUE if value was different, therefor updated in database
111
+     * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
112
+     * @since 29.0.0
113
+     * @see \OCP\IAppConfig for explanation about lazy loading
114
+     */
115
+    public function setAppValueString(
116
+        string $key,
117
+        string $value,
118
+        bool $lazy = false,
119
+        bool $sensitive = false,
120
+    ): bool {
121
+        return $this->appConfig->setValueString($this->appName, $key, $value, $lazy, $sensitive);
122
+    }
123 123
 
124
-	/**
125
-	 * @inheritDoc
126
-	 *
127
-	 * @param string $key config key
128
-	 * @param int $value config value
129
-	 * @param bool $lazy set config as lazy loaded
130
-	 * @param bool $sensitive if TRUE value will be hidden when listing config values.
131
-	 *
132
-	 * @return bool TRUE if value was different, therefor updated in database
133
-	 * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
134
-	 * @since 29.0.0
135
-	 * @see \OCP\IAppConfig for explanation about lazy loading
136
-	 */
137
-	public function setAppValueInt(
138
-		string $key,
139
-		int $value,
140
-		bool $lazy = false,
141
-		bool $sensitive = false,
142
-	): bool {
143
-		return $this->appConfig->setValueInt($this->appName, $key, $value, $lazy, $sensitive);
144
-	}
124
+    /**
125
+     * @inheritDoc
126
+     *
127
+     * @param string $key config key
128
+     * @param int $value config value
129
+     * @param bool $lazy set config as lazy loaded
130
+     * @param bool $sensitive if TRUE value will be hidden when listing config values.
131
+     *
132
+     * @return bool TRUE if value was different, therefor updated in database
133
+     * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
134
+     * @since 29.0.0
135
+     * @see \OCP\IAppConfig for explanation about lazy loading
136
+     */
137
+    public function setAppValueInt(
138
+        string $key,
139
+        int $value,
140
+        bool $lazy = false,
141
+        bool $sensitive = false,
142
+    ): bool {
143
+        return $this->appConfig->setValueInt($this->appName, $key, $value, $lazy, $sensitive);
144
+    }
145 145
 
146
-	/**
147
-	 * @inheritDoc
148
-	 *
149
-	 * @param string $key config key
150
-	 * @param float $value config value
151
-	 * @param bool $lazy set config as lazy loaded
152
-	 * @param bool $sensitive if TRUE value will be hidden when listing config values.
153
-	 *
154
-	 * @return bool TRUE if value was different, therefor updated in database
155
-	 * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
156
-	 * @since 29.0.0
157
-	 * @see \OCP\IAppConfig for explanation about lazy loading
158
-	 */
159
-	public function setAppValueFloat(
160
-		string $key,
161
-		float $value,
162
-		bool $lazy = false,
163
-		bool $sensitive = false,
164
-	): bool {
165
-		return $this->appConfig->setValueFloat($this->appName, $key, $value, $lazy, $sensitive);
166
-	}
146
+    /**
147
+     * @inheritDoc
148
+     *
149
+     * @param string $key config key
150
+     * @param float $value config value
151
+     * @param bool $lazy set config as lazy loaded
152
+     * @param bool $sensitive if TRUE value will be hidden when listing config values.
153
+     *
154
+     * @return bool TRUE if value was different, therefor updated in database
155
+     * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
156
+     * @since 29.0.0
157
+     * @see \OCP\IAppConfig for explanation about lazy loading
158
+     */
159
+    public function setAppValueFloat(
160
+        string $key,
161
+        float $value,
162
+        bool $lazy = false,
163
+        bool $sensitive = false,
164
+    ): bool {
165
+        return $this->appConfig->setValueFloat($this->appName, $key, $value, $lazy, $sensitive);
166
+    }
167 167
 
168
-	/**
169
-	 * @inheritDoc
170
-	 *
171
-	 * @param string $key config key
172
-	 * @param bool $value config value
173
-	 * @param bool $lazy set config as lazy loaded
174
-	 *
175
-	 * @return bool TRUE if value was different, therefor updated in database
176
-	 * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
177
-	 * @since 29.0.0
178
-	 * @see \OCP\IAppConfig for explanation about lazy loading
179
-	 */
180
-	public function setAppValueBool(
181
-		string $key,
182
-		bool $value,
183
-		bool $lazy = false,
184
-	): bool {
185
-		return $this->appConfig->setValueBool($this->appName, $key, $value, $lazy);
186
-	}
168
+    /**
169
+     * @inheritDoc
170
+     *
171
+     * @param string $key config key
172
+     * @param bool $value config value
173
+     * @param bool $lazy set config as lazy loaded
174
+     *
175
+     * @return bool TRUE if value was different, therefor updated in database
176
+     * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
177
+     * @since 29.0.0
178
+     * @see \OCP\IAppConfig for explanation about lazy loading
179
+     */
180
+    public function setAppValueBool(
181
+        string $key,
182
+        bool $value,
183
+        bool $lazy = false,
184
+    ): bool {
185
+        return $this->appConfig->setValueBool($this->appName, $key, $value, $lazy);
186
+    }
187 187
 
188
-	/**
189
-	 * @inheritDoc
190
-	 *
191
-	 * @param string $key config key
192
-	 * @param array $value config value
193
-	 * @param bool $lazy set config as lazy loaded
194
-	 * @param bool $sensitive if TRUE value will be hidden when listing config values.
195
-	 *
196
-	 * @return bool TRUE if value was different, therefor updated in database
197
-	 * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
198
-	 * @throws JsonException
199
-	 * @since 29.0.0
200
-	 * @see \OCP\IAppConfig for explanation about lazy loading
201
-	 */
202
-	public function setAppValueArray(
203
-		string $key,
204
-		array $value,
205
-		bool $lazy = false,
206
-		bool $sensitive = false,
207
-	): bool {
208
-		return $this->appConfig->setValueArray($this->appName, $key, $value, $lazy, $sensitive);
209
-	}
188
+    /**
189
+     * @inheritDoc
190
+     *
191
+     * @param string $key config key
192
+     * @param array $value config value
193
+     * @param bool $lazy set config as lazy loaded
194
+     * @param bool $sensitive if TRUE value will be hidden when listing config values.
195
+     *
196
+     * @return bool TRUE if value was different, therefor updated in database
197
+     * @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
198
+     * @throws JsonException
199
+     * @since 29.0.0
200
+     * @see \OCP\IAppConfig for explanation about lazy loading
201
+     */
202
+    public function setAppValueArray(
203
+        string $key,
204
+        array $value,
205
+        bool $lazy = false,
206
+        bool $sensitive = false,
207
+    ): bool {
208
+        return $this->appConfig->setValueArray($this->appName, $key, $value, $lazy, $sensitive);
209
+    }
210 210
 
211
-	/**
212
-	 * @param string $key
213
-	 * @param string $default
214
-	 *
215
-	 * @since 20.0.0
216
-	 * @deprecated 29.0.0 use {@see getAppValueString()}
217
-	 * @return string
218
-	 */
219
-	public function getAppValue(string $key, string $default = ''): string {
220
-		/** @psalm-suppress InternalMethod */
221
-		/** @psalm-suppress UndefinedInterfaceMethod */
222
-		return $this->appConfig->getValueMixed($this->appName, $key, $default);
223
-	}
211
+    /**
212
+     * @param string $key
213
+     * @param string $default
214
+     *
215
+     * @since 20.0.0
216
+     * @deprecated 29.0.0 use {@see getAppValueString()}
217
+     * @return string
218
+     */
219
+    public function getAppValue(string $key, string $default = ''): string {
220
+        /** @psalm-suppress InternalMethod */
221
+        /** @psalm-suppress UndefinedInterfaceMethod */
222
+        return $this->appConfig->getValueMixed($this->appName, $key, $default);
223
+    }
224 224
 
225
-	/**
226
-	 * @inheritDoc
227
-	 *
228
-	 * @param string $key config key
229
-	 * @param string $default default value
230
-	 * @param bool $lazy search within lazy loaded config
231
-	 *
232
-	 * @return string stored config value or $default if not set in database
233
-	 * @throws InvalidArgumentException if one of the argument format is invalid
234
-	 * @throws AppConfigTypeConflictException in case of conflict with the value type set in database
235
-	 * @since 29.0.0
236
-	 * @see \OCP\IAppConfig for explanation about lazy loading
237
-	 */
238
-	public function getAppValueString(string $key, string $default = '', bool $lazy = false): string {
239
-		return $this->appConfig->getValueString($this->appName, $key, $default, $lazy);
240
-	}
225
+    /**
226
+     * @inheritDoc
227
+     *
228
+     * @param string $key config key
229
+     * @param string $default default value
230
+     * @param bool $lazy search within lazy loaded config
231
+     *
232
+     * @return string stored config value or $default if not set in database
233
+     * @throws InvalidArgumentException if one of the argument format is invalid
234
+     * @throws AppConfigTypeConflictException in case of conflict with the value type set in database
235
+     * @since 29.0.0
236
+     * @see \OCP\IAppConfig for explanation about lazy loading
237
+     */
238
+    public function getAppValueString(string $key, string $default = '', bool $lazy = false): string {
239
+        return $this->appConfig->getValueString($this->appName, $key, $default, $lazy);
240
+    }
241 241
 
242
-	/**
243
-	 * @inheritDoc
244
-	 *
245
-	 * @param string $key config key
246
-	 * @param int $default default value
247
-	 * @param bool $lazy search within lazy loaded config
248
-	 *
249
-	 * @return int stored config value or $default if not set in database
250
-	 * @throws InvalidArgumentException if one of the argument format is invalid
251
-	 * @throws AppConfigTypeConflictException in case of conflict with the value type set in database
252
-	 * @since 29.0.0
253
-	 * @see \OCP\IAppConfig for explanation about lazy loading
254
-	 */
255
-	public function getAppValueInt(string $key, int $default = 0, bool $lazy = false): int {
256
-		return $this->appConfig->getValueInt($this->appName, $key, $default, $lazy);
257
-	}
242
+    /**
243
+     * @inheritDoc
244
+     *
245
+     * @param string $key config key
246
+     * @param int $default default value
247
+     * @param bool $lazy search within lazy loaded config
248
+     *
249
+     * @return int stored config value or $default if not set in database
250
+     * @throws InvalidArgumentException if one of the argument format is invalid
251
+     * @throws AppConfigTypeConflictException in case of conflict with the value type set in database
252
+     * @since 29.0.0
253
+     * @see \OCP\IAppConfig for explanation about lazy loading
254
+     */
255
+    public function getAppValueInt(string $key, int $default = 0, bool $lazy = false): int {
256
+        return $this->appConfig->getValueInt($this->appName, $key, $default, $lazy);
257
+    }
258 258
 
259
-	/**
260
-	 * @inheritDoc
261
-	 *
262
-	 * @param string $key config key
263
-	 * @param float $default default value
264
-	 * @param bool $lazy search within lazy loaded config
265
-	 *
266
-	 * @return float stored config value or $default if not set in database
267
-	 * @throws InvalidArgumentException if one of the argument format is invalid
268
-	 * @throws AppConfigTypeConflictException in case of conflict with the value type set in database
269
-	 * @since 29.0.0
270
-	 * @see \OCP\IAppConfig for explanation about lazy loading
271
-	 */
272
-	public function getAppValueFloat(string $key, float $default = 0, bool $lazy = false): float {
273
-		return $this->appConfig->getValueFloat($this->appName, $key, $default, $lazy);
274
-	}
259
+    /**
260
+     * @inheritDoc
261
+     *
262
+     * @param string $key config key
263
+     * @param float $default default value
264
+     * @param bool $lazy search within lazy loaded config
265
+     *
266
+     * @return float stored config value or $default if not set in database
267
+     * @throws InvalidArgumentException if one of the argument format is invalid
268
+     * @throws AppConfigTypeConflictException in case of conflict with the value type set in database
269
+     * @since 29.0.0
270
+     * @see \OCP\IAppConfig for explanation about lazy loading
271
+     */
272
+    public function getAppValueFloat(string $key, float $default = 0, bool $lazy = false): float {
273
+        return $this->appConfig->getValueFloat($this->appName, $key, $default, $lazy);
274
+    }
275 275
 
276
-	/**
277
-	 * @inheritDoc
278
-	 *
279
-	 * @param string $key config key
280
-	 * @param bool $default default value
281
-	 * @param bool $lazy search within lazy loaded config
282
-	 *
283
-	 * @return bool stored config value or $default if not set in database
284
-	 * @throws InvalidArgumentException if one of the argument format is invalid
285
-	 * @throws AppConfigTypeConflictException in case of conflict with the value type set in database
286
-	 * @since 29.0.0
287
-	 * @see \OCP\IAppConfig for explanation about lazy loading
288
-	 */
289
-	public function getAppValueBool(string $key, bool $default = false, bool $lazy = false): bool {
290
-		return $this->appConfig->getValueBool($this->appName, $key, $default, $lazy);
291
-	}
276
+    /**
277
+     * @inheritDoc
278
+     *
279
+     * @param string $key config key
280
+     * @param bool $default default value
281
+     * @param bool $lazy search within lazy loaded config
282
+     *
283
+     * @return bool stored config value or $default if not set in database
284
+     * @throws InvalidArgumentException if one of the argument format is invalid
285
+     * @throws AppConfigTypeConflictException in case of conflict with the value type set in database
286
+     * @since 29.0.0
287
+     * @see \OCP\IAppConfig for explanation about lazy loading
288
+     */
289
+    public function getAppValueBool(string $key, bool $default = false, bool $lazy = false): bool {
290
+        return $this->appConfig->getValueBool($this->appName, $key, $default, $lazy);
291
+    }
292 292
 
293
-	/**
294
-	 * @inheritDoc
295
-	 *
296
-	 * @param string $key config key
297
-	 * @param array $default default value
298
-	 * @param bool $lazy search within lazy loaded config
299
-	 *
300
-	 * @return array stored config value or $default if not set in database
301
-	 * @throws InvalidArgumentException if one of the argument format is invalid
302
-	 * @throws AppConfigTypeConflictException in case of conflict with the value type set in database
303
-	 * @since 29.0.0
304
-	 * @see \OCP\IAppConfig for explanation about lazy loading
305
-	 */
306
-	public function getAppValueArray(string $key, array $default = [], bool $lazy = false): array {
307
-		return $this->appConfig->getValueArray($this->appName, $key, $default, $lazy);
308
-	}
293
+    /**
294
+     * @inheritDoc
295
+     *
296
+     * @param string $key config key
297
+     * @param array $default default value
298
+     * @param bool $lazy search within lazy loaded config
299
+     *
300
+     * @return array stored config value or $default if not set in database
301
+     * @throws InvalidArgumentException if one of the argument format is invalid
302
+     * @throws AppConfigTypeConflictException in case of conflict with the value type set in database
303
+     * @since 29.0.0
304
+     * @see \OCP\IAppConfig for explanation about lazy loading
305
+     */
306
+    public function getAppValueArray(string $key, array $default = [], bool $lazy = false): array {
307
+        return $this->appConfig->getValueArray($this->appName, $key, $default, $lazy);
308
+    }
309 309
 
310
-	/**
311
-	 * @inheritDoc
312
-	 *
313
-	 * @param string $key the key of the value, under which it was saved
314
-	 * @since 20.0.0
315
-	 */
316
-	public function deleteAppValue(string $key): void {
317
-		$this->appConfig->deleteKey($this->appName, $key);
318
-	}
310
+    /**
311
+     * @inheritDoc
312
+     *
313
+     * @param string $key the key of the value, under which it was saved
314
+     * @since 20.0.0
315
+     */
316
+    public function deleteAppValue(string $key): void {
317
+        $this->appConfig->deleteKey($this->appName, $key);
318
+    }
319 319
 
320
-	/**
321
-	 * @inheritDoc
322
-	 *
323
-	 * @since 20.0.0
324
-	 */
325
-	public function deleteAppValues(): void {
326
-		$this->appConfig->deleteApp($this->appName);
327
-	}
320
+    /**
321
+     * @inheritDoc
322
+     *
323
+     * @since 20.0.0
324
+     */
325
+    public function deleteAppValues(): void {
326
+        $this->appConfig->deleteApp($this->appName);
327
+    }
328 328
 
329
-	public function setUserValue(string $userId, string $key, string $value, ?string $preCondition = null): void {
330
-		$this->config->setUserValue($userId, $this->appName, $key, $value, $preCondition);
331
-	}
329
+    public function setUserValue(string $userId, string $key, string $value, ?string $preCondition = null): void {
330
+        $this->config->setUserValue($userId, $this->appName, $key, $value, $preCondition);
331
+    }
332 332
 
333
-	public function getUserValue(string $userId, string $key, string $default = ''): string {
334
-		return $this->config->getUserValue($userId, $this->appName, $key, $default);
335
-	}
333
+    public function getUserValue(string $userId, string $key, string $default = ''): string {
334
+        return $this->config->getUserValue($userId, $this->appName, $key, $default);
335
+    }
336 336
 
337
-	public function deleteUserValue(string $userId, string $key): void {
338
-		$this->config->deleteUserValue($userId, $this->appName, $key);
339
-	}
337
+    public function deleteUserValue(string $userId, string $key): void {
338
+        $this->config->deleteUserValue($userId, $this->appName, $key);
339
+    }
340 340
 
341
-	/**
342
-	 * Returns the installed versions of all apps
343
-	 *
344
-	 * @return array<string, string>
345
-	 */
346
-	public function getAppInstalledVersions(bool $onlyEnabled = false): array {
347
-		return $this->appConfig->getAppInstalledVersions($onlyEnabled);
348
-	}
341
+    /**
342
+     * Returns the installed versions of all apps
343
+     *
344
+     * @return array<string, string>
345
+     */
346
+    public function getAppInstalledVersions(bool $onlyEnabled = false): array {
347
+        return $this->appConfig->getAppInstalledVersions($onlyEnabled);
348
+    }
349 349
 }
Please login to merge, or discard this patch.
lib/public/App/IAppManager.php 1 patch
Indentation   +321 added lines, -321 removed lines patch added patch discarded remove patch
@@ -19,325 +19,325 @@
 block discarded – undo
19 19
  * @since 8.0.0
20 20
  */
21 21
 interface IAppManager {
22
-	/**
23
-	 * @since 30.0.0
24
-	 */
25
-	public const BACKEND_CALDAV = 'caldav';
26
-
27
-	/**
28
-	 * Returns the app information from "appinfo/info.xml" for an app
29
-	 *
30
-	 * @param string|null $lang
31
-	 * @return array|null
32
-	 * @since 14.0.0
33
-	 * @since 31.0.0 Usage of $path is discontinued and throws an \InvalidArgumentException, use {@see self::getAppInfoByPath} instead.
34
-	 */
35
-	public function getAppInfo(string $appId, bool $path = false, $lang = null);
36
-
37
-	/**
38
-	 * Returns the app information from a given path ending with "/appinfo/info.xml"
39
-	 *
40
-	 * @since 31.0.0
41
-	 */
42
-	public function getAppInfoByPath(string $path, ?string $lang = null): ?array;
43
-
44
-	/**
45
-	 * Returns the app information from "appinfo/info.xml".
46
-	 *
47
-	 * @param string $appId
48
-	 * @param bool $useCache
49
-	 * @return string
50
-	 * @since 14.0.0
51
-	 */
52
-	public function getAppVersion(string $appId, bool $useCache = true): string;
53
-
54
-	/**
55
-	 * Returns the installed version of all apps
56
-	 *
57
-	 * @return array<string, string>
58
-	 * @since 32.0.0
59
-	 */
60
-	public function getAppInstalledVersions(bool $onlyEnabled = false): array;
61
-
62
-	/**
63
-	 * Returns the app icon or null if none is found
64
-	 *
65
-	 * @param string $appId
66
-	 * @param bool $dark Enable to request a dark icon variant, default is a white icon
67
-	 * @return string|null
68
-	 * @since 29.0.0
69
-	 */
70
-	public function getAppIcon(string $appId, bool $dark = false): ?string;
71
-
72
-	/**
73
-	 * Check if an app is enabled for user
74
-	 *
75
-	 * @param string $appId
76
-	 * @param \OCP\IUser|null $user (optional) if not defined, the currently loggedin user will be used
77
-	 * @return bool
78
-	 * @since 8.0.0
79
-	 */
80
-	public function isEnabledForUser($appId, $user = null);
81
-
82
-	/**
83
-	 * Check if an app is enabled in the instance
84
-	 *
85
-	 * Notice: This actually checks if the app is enabled and not only if it is installed.
86
-	 *
87
-	 * @param string $appId
88
-	 * @return bool
89
-	 * @since 8.0.0
90
-	 * @deprecated 32.0.0 Use either {@see self::isEnabledForUser} or {@see self::isEnabledForAnyone}
91
-	 */
92
-	public function isInstalled($appId);
93
-
94
-	/**
95
-	 * Check if an app is enabled in the instance, either for everyone or for specific groups
96
-	 *
97
-	 * @since 32.0.0
98
-	 */
99
-	public function isEnabledForAnyone(string $appId): bool;
100
-
101
-	/**
102
-	 * Check if an app should be enabled by default
103
-	 *
104
-	 * Notice: This actually checks if the app should be enabled by default
105
-	 * and not if currently installed/enabled
106
-	 *
107
-	 * @param string $appId ID of the app
108
-	 * @since 25.0.0
109
-	 */
110
-	public function isDefaultEnabled(string $appId):bool;
111
-
112
-	/**
113
-	 * Load an app, if not already loaded
114
-	 * @param string $app app id
115
-	 * @since 27.0.0
116
-	 */
117
-	public function loadApp(string $app): void;
118
-
119
-	/**
120
-	 * Check if an app is loaded
121
-	 * @param string $app app id
122
-	 * @since 27.0.0
123
-	 */
124
-	public function isAppLoaded(string $app): bool;
125
-
126
-	/**
127
-	 * Enable an app for every user
128
-	 *
129
-	 * @param string $appId
130
-	 * @param bool $forceEnable
131
-	 * @throws AppPathNotFoundException
132
-	 * @since 8.0.0
133
-	 */
134
-	public function enableApp(string $appId, bool $forceEnable = false): void;
135
-
136
-	/**
137
-	 * Whether a list of types contains a protected app type
138
-	 *
139
-	 * @param string[] $types
140
-	 * @return bool
141
-	 * @since 12.0.0
142
-	 */
143
-	public function hasProtectedAppType($types);
144
-
145
-	/**
146
-	 * Enable an app only for specific groups
147
-	 *
148
-	 * @param string $appId
149
-	 * @param \OCP\IGroup[] $groups
150
-	 * @param bool $forceEnable
151
-	 * @throws \Exception
152
-	 * @since 8.0.0
153
-	 */
154
-	public function enableAppForGroups(string $appId, array $groups, bool $forceEnable = false): void;
155
-
156
-	/**
157
-	 * Disable an app for every user
158
-	 *
159
-	 * @param string $appId
160
-	 * @param bool $automaticDisabled
161
-	 * @since 8.0.0
162
-	 */
163
-	public function disableApp($appId, $automaticDisabled = false): void;
164
-
165
-	/**
166
-	 * Get the directory for the given app.
167
-	 *
168
-	 * @since 11.0.0
169
-	 * @throws AppPathNotFoundException
170
-	 */
171
-	public function getAppPath(string $appId): string;
172
-
173
-	/**
174
-	 * Get the web path for the given app.
175
-	 *
176
-	 * @param string $appId
177
-	 * @return string
178
-	 * @since 18.0.0
179
-	 * @throws AppPathNotFoundException
180
-	 */
181
-	public function getAppWebPath(string $appId): string;
182
-
183
-	/**
184
-	 * List all apps enabled for a user
185
-	 *
186
-	 * @param \OCP\IUser $user
187
-	 * @return string[]
188
-	 * @since 8.1.0
189
-	 */
190
-	public function getEnabledAppsForUser(IUser $user);
191
-
192
-	/**
193
-	 * List all installed apps
194
-	 *
195
-	 * @return string[]
196
-	 * @since 8.1.0
197
-	 * @deprecated 32.0.0 Use either {@see self::getEnabledApps} or {@see self::getEnabledAppsForUser}
198
-	 */
199
-	public function getInstalledApps();
200
-
201
-	/**
202
-	 * List all apps enabled, either for everyone or for specific groups only
203
-	 *
204
-	 * @return list<string>
205
-	 * @since 32.0.0
206
-	 */
207
-	public function getEnabledApps(): array;
208
-
209
-	/**
210
-	 * Clear the cached list of apps when enabling/disabling an app
211
-	 * @since 8.1.0
212
-	 */
213
-	public function clearAppsCache(): void;
214
-
215
-	/**
216
-	 * @param string $appId
217
-	 * @return boolean
218
-	 * @since 9.0.0
219
-	 */
220
-	public function isShipped($appId);
221
-
222
-	/**
223
-	 * Loads all apps
224
-	 *
225
-	 * @param string[] $types
226
-	 * @return bool
227
-	 *
228
-	 * This function walks through the Nextcloud directory and loads all apps
229
-	 * it can find. A directory contains an app if the file `/appinfo/info.xml`
230
-	 * exists.
231
-	 *
232
-	 * if $types is set to non-empty array, only apps of those types will be loaded
233
-	 * @since 27.0.0
234
-	 */
235
-	public function loadApps(array $types = []): bool;
236
-
237
-	/**
238
-	 * Check if an app is of a specific type
239
-	 * @since 27.0.0
240
-	 */
241
-	public function isType(string $app, array $types): bool;
242
-
243
-	/**
244
-	 * @return string[]
245
-	 * @since 9.0.0
246
-	 */
247
-	public function getAlwaysEnabledApps();
248
-
249
-	/**
250
-	 * @return string[] app IDs
251
-	 * @since 25.0.0
252
-	 */
253
-	public function getDefaultEnabledApps(): array;
254
-
255
-	/**
256
-	 * @param \OCP\IGroup $group
257
-	 * @return String[]
258
-	 * @since 17.0.0
259
-	 */
260
-	public function getEnabledAppsForGroup(IGroup $group): array;
261
-
262
-	/**
263
-	 * @param String $appId
264
-	 * @return string[]
265
-	 * @since 17.0.0
266
-	 */
267
-	public function getAppRestriction(string $appId): array;
268
-
269
-	/**
270
-	 * Returns the id of the user's default app
271
-	 *
272
-	 * If `user` is not passed, the currently logged in user will be used
273
-	 *
274
-	 * @param ?IUser $user User to query default app for
275
-	 * @param bool $withFallbacks Include fallback values if no default app was configured manually
276
-	 *                            Before falling back to predefined default apps,
277
-	 *                            the user defined app order is considered and the first app would be used as the fallback.
278
-	 *
279
-	 * @since 25.0.6
280
-	 * @since 28.0.0 Added optional $withFallbacks parameter
281
-	 * @deprecated 31.0.0
282
-	 * Use @see \OCP\INavigationManager::getDefaultEntryIdForUser() instead
283
-	 */
284
-	public function getDefaultAppForUser(?IUser $user = null, bool $withFallbacks = true): string;
285
-
286
-	/**
287
-	 * Get the global default apps with fallbacks
288
-	 *
289
-	 * @return string[] The default applications
290
-	 * @since 28.0.0
291
-	 * @deprecated 31.0.0
292
-	 * Use @see \OCP\INavigationManager::getDefaultEntryIds() instead
293
-	 */
294
-	public function getDefaultApps(): array;
295
-
296
-	/**
297
-	 * Set the global default apps with fallbacks
298
-	 *
299
-	 * @param string[] $defaultApps
300
-	 * @throws \InvalidArgumentException If any of the apps is not installed
301
-	 * @since 28.0.0
302
-	 * @deprecated 31.0.0
303
-	 * Use @see \OCP\INavigationManager::setDefaultEntryIds() instead
304
-	 */
305
-	public function setDefaultApps(array $defaultApps): void;
306
-
307
-	/**
308
-	 * Check whether the given backend is required by at least one app.
309
-	 *
310
-	 * @param self::BACKEND_* $backend Name of the backend, one of `self::BACKEND_*`
311
-	 * @return bool True if at least one app requires the backend
312
-	 *
313
-	 * @since 30.0.0
314
-	 */
315
-	public function isBackendRequired(string $backend): bool;
316
-
317
-	/**
318
-	 * Clean the appId from forbidden characters
319
-	 *
320
-	 * @psalm-taint-escape callable
321
-	 * @psalm-taint-escape cookie
322
-	 * @psalm-taint-escape file
323
-	 * @psalm-taint-escape has_quotes
324
-	 * @psalm-taint-escape header
325
-	 * @psalm-taint-escape html
326
-	 * @psalm-taint-escape include
327
-	 * @psalm-taint-escape ldap
328
-	 * @psalm-taint-escape shell
329
-	 * @psalm-taint-escape sql
330
-	 * @psalm-taint-escape unserialize
331
-	 *
332
-	 * @since 31.0.0
333
-	 */
334
-	public function cleanAppId(string $app): string;
335
-
336
-	/**
337
-	 * Get a list of all apps in the apps folder
338
-	 *
339
-	 * @return list<string> an array of app names (string IDs)
340
-	 * @since 31.0.0
341
-	 */
342
-	public function getAllAppsInAppsFolders(): array;
22
+    /**
23
+     * @since 30.0.0
24
+     */
25
+    public const BACKEND_CALDAV = 'caldav';
26
+
27
+    /**
28
+     * Returns the app information from "appinfo/info.xml" for an app
29
+     *
30
+     * @param string|null $lang
31
+     * @return array|null
32
+     * @since 14.0.0
33
+     * @since 31.0.0 Usage of $path is discontinued and throws an \InvalidArgumentException, use {@see self::getAppInfoByPath} instead.
34
+     */
35
+    public function getAppInfo(string $appId, bool $path = false, $lang = null);
36
+
37
+    /**
38
+     * Returns the app information from a given path ending with "/appinfo/info.xml"
39
+     *
40
+     * @since 31.0.0
41
+     */
42
+    public function getAppInfoByPath(string $path, ?string $lang = null): ?array;
43
+
44
+    /**
45
+     * Returns the app information from "appinfo/info.xml".
46
+     *
47
+     * @param string $appId
48
+     * @param bool $useCache
49
+     * @return string
50
+     * @since 14.0.0
51
+     */
52
+    public function getAppVersion(string $appId, bool $useCache = true): string;
53
+
54
+    /**
55
+     * Returns the installed version of all apps
56
+     *
57
+     * @return array<string, string>
58
+     * @since 32.0.0
59
+     */
60
+    public function getAppInstalledVersions(bool $onlyEnabled = false): array;
61
+
62
+    /**
63
+     * Returns the app icon or null if none is found
64
+     *
65
+     * @param string $appId
66
+     * @param bool $dark Enable to request a dark icon variant, default is a white icon
67
+     * @return string|null
68
+     * @since 29.0.0
69
+     */
70
+    public function getAppIcon(string $appId, bool $dark = false): ?string;
71
+
72
+    /**
73
+     * Check if an app is enabled for user
74
+     *
75
+     * @param string $appId
76
+     * @param \OCP\IUser|null $user (optional) if not defined, the currently loggedin user will be used
77
+     * @return bool
78
+     * @since 8.0.0
79
+     */
80
+    public function isEnabledForUser($appId, $user = null);
81
+
82
+    /**
83
+     * Check if an app is enabled in the instance
84
+     *
85
+     * Notice: This actually checks if the app is enabled and not only if it is installed.
86
+     *
87
+     * @param string $appId
88
+     * @return bool
89
+     * @since 8.0.0
90
+     * @deprecated 32.0.0 Use either {@see self::isEnabledForUser} or {@see self::isEnabledForAnyone}
91
+     */
92
+    public function isInstalled($appId);
93
+
94
+    /**
95
+     * Check if an app is enabled in the instance, either for everyone or for specific groups
96
+     *
97
+     * @since 32.0.0
98
+     */
99
+    public function isEnabledForAnyone(string $appId): bool;
100
+
101
+    /**
102
+     * Check if an app should be enabled by default
103
+     *
104
+     * Notice: This actually checks if the app should be enabled by default
105
+     * and not if currently installed/enabled
106
+     *
107
+     * @param string $appId ID of the app
108
+     * @since 25.0.0
109
+     */
110
+    public function isDefaultEnabled(string $appId):bool;
111
+
112
+    /**
113
+     * Load an app, if not already loaded
114
+     * @param string $app app id
115
+     * @since 27.0.0
116
+     */
117
+    public function loadApp(string $app): void;
118
+
119
+    /**
120
+     * Check if an app is loaded
121
+     * @param string $app app id
122
+     * @since 27.0.0
123
+     */
124
+    public function isAppLoaded(string $app): bool;
125
+
126
+    /**
127
+     * Enable an app for every user
128
+     *
129
+     * @param string $appId
130
+     * @param bool $forceEnable
131
+     * @throws AppPathNotFoundException
132
+     * @since 8.0.0
133
+     */
134
+    public function enableApp(string $appId, bool $forceEnable = false): void;
135
+
136
+    /**
137
+     * Whether a list of types contains a protected app type
138
+     *
139
+     * @param string[] $types
140
+     * @return bool
141
+     * @since 12.0.0
142
+     */
143
+    public function hasProtectedAppType($types);
144
+
145
+    /**
146
+     * Enable an app only for specific groups
147
+     *
148
+     * @param string $appId
149
+     * @param \OCP\IGroup[] $groups
150
+     * @param bool $forceEnable
151
+     * @throws \Exception
152
+     * @since 8.0.0
153
+     */
154
+    public function enableAppForGroups(string $appId, array $groups, bool $forceEnable = false): void;
155
+
156
+    /**
157
+     * Disable an app for every user
158
+     *
159
+     * @param string $appId
160
+     * @param bool $automaticDisabled
161
+     * @since 8.0.0
162
+     */
163
+    public function disableApp($appId, $automaticDisabled = false): void;
164
+
165
+    /**
166
+     * Get the directory for the given app.
167
+     *
168
+     * @since 11.0.0
169
+     * @throws AppPathNotFoundException
170
+     */
171
+    public function getAppPath(string $appId): string;
172
+
173
+    /**
174
+     * Get the web path for the given app.
175
+     *
176
+     * @param string $appId
177
+     * @return string
178
+     * @since 18.0.0
179
+     * @throws AppPathNotFoundException
180
+     */
181
+    public function getAppWebPath(string $appId): string;
182
+
183
+    /**
184
+     * List all apps enabled for a user
185
+     *
186
+     * @param \OCP\IUser $user
187
+     * @return string[]
188
+     * @since 8.1.0
189
+     */
190
+    public function getEnabledAppsForUser(IUser $user);
191
+
192
+    /**
193
+     * List all installed apps
194
+     *
195
+     * @return string[]
196
+     * @since 8.1.0
197
+     * @deprecated 32.0.0 Use either {@see self::getEnabledApps} or {@see self::getEnabledAppsForUser}
198
+     */
199
+    public function getInstalledApps();
200
+
201
+    /**
202
+     * List all apps enabled, either for everyone or for specific groups only
203
+     *
204
+     * @return list<string>
205
+     * @since 32.0.0
206
+     */
207
+    public function getEnabledApps(): array;
208
+
209
+    /**
210
+     * Clear the cached list of apps when enabling/disabling an app
211
+     * @since 8.1.0
212
+     */
213
+    public function clearAppsCache(): void;
214
+
215
+    /**
216
+     * @param string $appId
217
+     * @return boolean
218
+     * @since 9.0.0
219
+     */
220
+    public function isShipped($appId);
221
+
222
+    /**
223
+     * Loads all apps
224
+     *
225
+     * @param string[] $types
226
+     * @return bool
227
+     *
228
+     * This function walks through the Nextcloud directory and loads all apps
229
+     * it can find. A directory contains an app if the file `/appinfo/info.xml`
230
+     * exists.
231
+     *
232
+     * if $types is set to non-empty array, only apps of those types will be loaded
233
+     * @since 27.0.0
234
+     */
235
+    public function loadApps(array $types = []): bool;
236
+
237
+    /**
238
+     * Check if an app is of a specific type
239
+     * @since 27.0.0
240
+     */
241
+    public function isType(string $app, array $types): bool;
242
+
243
+    /**
244
+     * @return string[]
245
+     * @since 9.0.0
246
+     */
247
+    public function getAlwaysEnabledApps();
248
+
249
+    /**
250
+     * @return string[] app IDs
251
+     * @since 25.0.0
252
+     */
253
+    public function getDefaultEnabledApps(): array;
254
+
255
+    /**
256
+     * @param \OCP\IGroup $group
257
+     * @return String[]
258
+     * @since 17.0.0
259
+     */
260
+    public function getEnabledAppsForGroup(IGroup $group): array;
261
+
262
+    /**
263
+     * @param String $appId
264
+     * @return string[]
265
+     * @since 17.0.0
266
+     */
267
+    public function getAppRestriction(string $appId): array;
268
+
269
+    /**
270
+     * Returns the id of the user's default app
271
+     *
272
+     * If `user` is not passed, the currently logged in user will be used
273
+     *
274
+     * @param ?IUser $user User to query default app for
275
+     * @param bool $withFallbacks Include fallback values if no default app was configured manually
276
+     *                            Before falling back to predefined default apps,
277
+     *                            the user defined app order is considered and the first app would be used as the fallback.
278
+     *
279
+     * @since 25.0.6
280
+     * @since 28.0.0 Added optional $withFallbacks parameter
281
+     * @deprecated 31.0.0
282
+     * Use @see \OCP\INavigationManager::getDefaultEntryIdForUser() instead
283
+     */
284
+    public function getDefaultAppForUser(?IUser $user = null, bool $withFallbacks = true): string;
285
+
286
+    /**
287
+     * Get the global default apps with fallbacks
288
+     *
289
+     * @return string[] The default applications
290
+     * @since 28.0.0
291
+     * @deprecated 31.0.0
292
+     * Use @see \OCP\INavigationManager::getDefaultEntryIds() instead
293
+     */
294
+    public function getDefaultApps(): array;
295
+
296
+    /**
297
+     * Set the global default apps with fallbacks
298
+     *
299
+     * @param string[] $defaultApps
300
+     * @throws \InvalidArgumentException If any of the apps is not installed
301
+     * @since 28.0.0
302
+     * @deprecated 31.0.0
303
+     * Use @see \OCP\INavigationManager::setDefaultEntryIds() instead
304
+     */
305
+    public function setDefaultApps(array $defaultApps): void;
306
+
307
+    /**
308
+     * Check whether the given backend is required by at least one app.
309
+     *
310
+     * @param self::BACKEND_* $backend Name of the backend, one of `self::BACKEND_*`
311
+     * @return bool True if at least one app requires the backend
312
+     *
313
+     * @since 30.0.0
314
+     */
315
+    public function isBackendRequired(string $backend): bool;
316
+
317
+    /**
318
+     * Clean the appId from forbidden characters
319
+     *
320
+     * @psalm-taint-escape callable
321
+     * @psalm-taint-escape cookie
322
+     * @psalm-taint-escape file
323
+     * @psalm-taint-escape has_quotes
324
+     * @psalm-taint-escape header
325
+     * @psalm-taint-escape html
326
+     * @psalm-taint-escape include
327
+     * @psalm-taint-escape ldap
328
+     * @psalm-taint-escape shell
329
+     * @psalm-taint-escape sql
330
+     * @psalm-taint-escape unserialize
331
+     *
332
+     * @since 31.0.0
333
+     */
334
+    public function cleanAppId(string $app): string;
335
+
336
+    /**
337
+     * Get a list of all apps in the apps folder
338
+     *
339
+     * @return list<string> an array of app names (string IDs)
340
+     * @since 31.0.0
341
+     */
342
+    public function getAllAppsInAppsFolders(): array;
343 343
 }
Please login to merge, or discard this patch.
lib/public/IAppConfig.php 1 patch
Indentation   +485 added lines, -485 removed lines patch added patch discarded remove patch
@@ -30,489 +30,489 @@
 block discarded – undo
30 30
  * @since 29.0.0 - Supporting types and lazy loading
31 31
  */
32 32
 interface IAppConfig {
33
-	/** @since 29.0.0 */
34
-	public const VALUE_SENSITIVE = 1;
35
-	/** @since 29.0.0 */
36
-	public const VALUE_MIXED = 2;
37
-	/** @since 29.0.0 */
38
-	public const VALUE_STRING = 4;
39
-	/** @since 29.0.0 */
40
-	public const VALUE_INT = 8;
41
-	/** @since 29.0.0 */
42
-	public const VALUE_FLOAT = 16;
43
-	/** @since 29.0.0 */
44
-	public const VALUE_BOOL = 32;
45
-	/** @since 29.0.0 */
46
-	public const VALUE_ARRAY = 64;
47
-
48
-	/** @since 31.0.0 */
49
-	public const FLAG_SENSITIVE = 1;   // value is sensitive
50
-
51
-	/**
52
-	 * Get list of all apps that have at least one config value stored in database
53
-	 *
54
-	 * **WARNING:** ignore lazy filtering, all config values are loaded from database
55
-	 *
56
-	 * @return list<string> list of app ids
57
-	 * @since 7.0.0
58
-	 */
59
-	public function getApps(): array;
60
-
61
-	/**
62
-	 * Returns all keys stored in database, related to an app.
63
-	 * Please note that the values are not returned.
64
-	 *
65
-	 * **WARNING:** ignore lazy filtering, all config values are loaded from database
66
-	 *
67
-	 * @param string $app id of the app
68
-	 *
69
-	 * @return list<string> list of stored config keys
70
-	 * @since 29.0.0
71
-	 */
72
-	public function getKeys(string $app): array;
73
-
74
-	/**
75
-	 * Check if a key exists in the list of stored config values.
76
-	 *
77
-	 * @param string $app id of the app
78
-	 * @param string $key config key
79
-	 * @param bool $lazy search within lazy loaded config
80
-	 *
81
-	 * @return bool TRUE if key exists
82
-	 * @since 29.0.0 Added the $lazy argument
83
-	 * @since 7.0.0
84
-	 */
85
-	public function hasKey(string $app, string $key, ?bool $lazy = false): bool;
86
-
87
-	/**
88
-	 * best way to see if a value is set as sensitive (not displayed in report)
89
-	 *
90
-	 * @param string $app id of the app
91
-	 * @param string $key config key
92
-	 * @param bool|null $lazy search within lazy loaded config
93
-	 *
94
-	 * @return bool TRUE if value is sensitive
95
-	 * @throws AppConfigUnknownKeyException if config key is not known
96
-	 * @since 29.0.0
97
-	 */
98
-	public function isSensitive(string $app, string $key, ?bool $lazy = false): bool;
99
-
100
-	/**
101
-	 * Returns if the config key stored in database is lazy loaded
102
-	 *
103
-	 * **WARNING:** ignore lazy filtering, all config values are loaded from database
104
-	 *
105
-	 * @param string $app id of the app
106
-	 * @param string $key config key
107
-	 *
108
-	 * @return bool TRUE if config is lazy loaded
109
-	 * @throws AppConfigUnknownKeyException if config key is not known
110
-	 * @see IAppConfig for details about lazy loading
111
-	 * @since 29.0.0
112
-	 */
113
-	public function isLazy(string $app, string $key): bool;
114
-
115
-	/**
116
-	 * List all config values from an app with config key starting with $key.
117
-	 * Returns an array with config key as key, stored value as value.
118
-	 *
119
-	 * **WARNING:** ignore lazy filtering, all config values are loaded from database
120
-	 *
121
-	 * @param string $app id of the app
122
-	 * @param string $prefix config keys prefix to search, can be empty.
123
-	 * @param bool $filtered filter sensitive config values
124
-	 *
125
-	 * @return array<string, string|int|float|bool|array> [configKey => configValue]
126
-	 * @since 29.0.0
127
-	 */
128
-	public function getAllValues(string $app, string $prefix = '', bool $filtered = false): array;
129
-
130
-	/**
131
-	 * List all apps storing a specific config key and its stored value.
132
-	 * Returns an array with appId as key, stored value as value.
133
-	 *
134
-	 * @param string $key config key
135
-	 * @param bool $lazy search within lazy loaded config
136
-	 * @param int|null $typedAs enforce type for the returned values {@see self::VALUE_STRING} and others
137
-	 *
138
-	 * @return array<string, string|int|float|bool|array> [appId => configValue]
139
-	 * @since 29.0.0
140
-	 */
141
-	public function searchValues(string $key, bool $lazy = false, ?int $typedAs = null): array;
142
-
143
-	/**
144
-	 * Get config value assigned to a config key.
145
-	 * If config key is not found in database, default value is returned.
146
-	 * If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE.
147
-	 *
148
-	 * @param string $app id of the app
149
-	 * @param string $key config key
150
-	 * @param string $default default value
151
-	 * @param bool $lazy search within lazy loaded config
152
-	 *
153
-	 * @return string stored config value or $default if not set in database
154
-	 * @since 29.0.0
155
-	 * @see IAppConfig for explanation about lazy loading
156
-	 * @see getValueInt()
157
-	 * @see getValueFloat()
158
-	 * @see getValueBool()
159
-	 * @see getValueArray()
160
-	 */
161
-	public function getValueString(string $app, string $key, string $default = '', bool $lazy = false): string;
162
-
163
-	/**
164
-	 * Get config value assigned to a config key.
165
-	 * If config key is not found in database, default value is returned.
166
-	 * If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE.
167
-	 *
168
-	 * @param string $app id of the app
169
-	 * @param string $key config key
170
-	 * @param int $default default value
171
-	 * @param bool $lazy search within lazy loaded config
172
-	 *
173
-	 * @return int stored config value or $default if not set in database
174
-	 * @since 29.0.0
175
-	 * @see IAppConfig for explanation about lazy loading
176
-	 * @see getValueString()
177
-	 * @see getValueFloat()
178
-	 * @see getValueBool()
179
-	 * @see getValueArray()
180
-	 */
181
-	public function getValueInt(string $app, string $key, int $default = 0, bool $lazy = false): int;
182
-
183
-	/**
184
-	 * Get config value assigned to a config key.
185
-	 * If config key is not found in database, default value is returned.
186
-	 * If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE.
187
-	 *
188
-	 * @param string $app id of the app
189
-	 * @param string $key config key
190
-	 * @param float $default default value
191
-	 * @param bool $lazy search within lazy loaded config
192
-	 *
193
-	 * @return float stored config value or $default if not set in database
194
-	 * @since 29.0.0
195
-	 * @see IAppConfig for explanation about lazy loading
196
-	 * @see getValueString()
197
-	 * @see getValueInt()
198
-	 * @see getValueBool()
199
-	 * @see getValueArray()
200
-	 */
201
-	public function getValueFloat(string $app, string $key, float $default = 0, bool $lazy = false): float;
202
-
203
-	/**
204
-	 * Get config value assigned to a config key.
205
-	 * If config key is not found in database, default value is returned.
206
-	 * If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE.
207
-	 *
208
-	 * @param string $app id of the app
209
-	 * @param string $key config key
210
-	 * @param bool $default default value
211
-	 * @param bool $lazy search within lazy loaded config
212
-	 *
213
-	 * @return bool stored config value or $default if not set in database
214
-	 * @since 29.0.0
215
-	 * @see IAppConfig for explanation about lazy loading
216
-	 * @see getValueString()
217
-	 * @see getValueInt()
218
-	 * @see getValueFloat()
219
-	 * @see getValueArray()
220
-	 */
221
-	public function getValueBool(string $app, string $key, bool $default = false, bool $lazy = false): bool;
222
-
223
-	/**
224
-	 * Get config value assigned to a config key.
225
-	 * If config key is not found in database, default value is returned.
226
-	 * If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE.
227
-	 *
228
-	 * @param string $app id of the app
229
-	 * @param string $key config key
230
-	 * @param array $default default value
231
-	 * @param bool $lazy search within lazy loaded config
232
-	 *
233
-	 * @return array stored config value or $default if not set in database
234
-	 * @since 29.0.0
235
-	 * @see IAppConfig for explanation about lazy loading
236
-	 * @see getValueString()
237
-	 * @see getValueInt()
238
-	 * @see getValueFloat()
239
-	 * @see getValueBool()
240
-	 */
241
-	public function getValueArray(string $app, string $key, array $default = [], bool $lazy = false): array;
242
-
243
-	/**
244
-	 * returns the type of config value
245
-	 *
246
-	 * **WARNING:** ignore lazy filtering, all config values are loaded from database
247
-	 *              unless lazy is set to false
248
-	 *
249
-	 * @param string $app id of the app
250
-	 * @param string $key config key
251
-	 * @param bool|null $lazy
252
-	 *
253
-	 * @return int
254
-	 * @throws AppConfigUnknownKeyException
255
-	 * @since 29.0.0
256
-	 * @see VALUE_STRING
257
-	 * @see VALUE_INT
258
-	 * @see VALUE_FLOAT
259
-	 * @see VALUE_BOOL
260
-	 * @see VALUE_ARRAY
261
-	 */
262
-	public function getValueType(string $app, string $key, ?bool $lazy = null): int;
263
-
264
-	/**
265
-	 * Store a config key and its value in database
266
-	 *
267
-	 * If config key is already known with the exact same config value, the database is not updated.
268
-	 * If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded.
269
-	 *
270
-	 * If config value was previously stored as sensitive or lazy loaded, status cannot be altered without using {@see deleteKey()} first
271
-	 *
272
-	 * @param string $app id of the app
273
-	 * @param string $key config key
274
-	 * @param string $value config value
275
-	 * @param bool $sensitive if TRUE value will be hidden when listing config values.
276
-	 * @param bool $lazy set config as lazy loaded
277
-	 *
278
-	 * @return bool TRUE if value was different, therefor updated in database
279
-	 * @since 29.0.0
280
-	 * @see IAppConfig for explanation about lazy loading
281
-	 * @see setValueInt()
282
-	 * @see setValueFloat()
283
-	 * @see setValueBool()
284
-	 * @see setValueArray()
285
-	 */
286
-	public function setValueString(string $app, string $key, string $value, bool $lazy = false, bool $sensitive = false): bool;
287
-
288
-	/**
289
-	 * Store a config key and its value in database
290
-	 *
291
-	 * When handling huge value around and/or above 2,147,483,647, a debug log will be generated
292
-	 * on 64bits system, as php int type reach its limit (and throw an exception) on 32bits when using huge numbers.
293
-	 *
294
-	 * When using huge numbers, it is advised to use {@see \OCP\Util::numericToNumber()} and {@see setValueString()}
295
-	 *
296
-	 * If config key is already known with the exact same config value, the database is not updated.
297
-	 * If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded.
298
-	 *
299
-	 * If config value was previously stored as sensitive or lazy loaded, status cannot be altered without using {@see deleteKey()} first
300
-	 *
301
-	 * @param string $app id of the app
302
-	 * @param string $key config key
303
-	 * @param int $value config value
304
-	 * @param bool $sensitive if TRUE value will be hidden when listing config values.
305
-	 * @param bool $lazy set config as lazy loaded
306
-	 *
307
-	 * @return bool TRUE if value was different, therefor updated in database
308
-	 * @since 29.0.0
309
-	 * @see IAppConfig for explanation about lazy loading
310
-	 * @see setValueString()
311
-	 * @see setValueFloat()
312
-	 * @see setValueBool()
313
-	 * @see setValueArray()
314
-	 */
315
-	public function setValueInt(string $app, string $key, int $value, bool $lazy = false, bool $sensitive = false): bool;
316
-
317
-	/**
318
-	 * Store a config key and its value in database.
319
-	 *
320
-	 * If config key is already known with the exact same config value, the database is not updated.
321
-	 * If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded.
322
-	 *
323
-	 * If config value was previously stored as sensitive or lazy loaded, status cannot be altered without using {@see deleteKey()} first
324
-	 *
325
-	 * @param string $app id of the app
326
-	 * @param string $key config key
327
-	 * @param float $value config value
328
-	 * @param bool $sensitive if TRUE value will be hidden when listing config values.
329
-	 * @param bool $lazy set config as lazy loaded
330
-	 *
331
-	 * @return bool TRUE if value was different, therefor updated in database
332
-	 * @since 29.0.0
333
-	 * @see IAppConfig for explanation about lazy loading
334
-	 * @see setValueString()
335
-	 * @see setValueInt()
336
-	 * @see setValueBool()
337
-	 * @see setValueArray()
338
-	 */
339
-	public function setValueFloat(string $app, string $key, float $value, bool $lazy = false, bool $sensitive = false): bool;
340
-
341
-	/**
342
-	 * Store a config key and its value in database
343
-	 *
344
-	 * If config key is already known with the exact same config value, the database is not updated.
345
-	 * If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded.
346
-	 *
347
-	 * If config value was previously stored as lazy loaded, status cannot be altered without using {@see deleteKey()} first
348
-	 *
349
-	 * @param string $app id of the app
350
-	 * @param string $key config key
351
-	 * @param bool $value config value
352
-	 * @param bool $lazy set config as lazy loaded
353
-	 *
354
-	 * @return bool TRUE if value was different, therefor updated in database
355
-	 * @since 29.0.0
356
-	 * @see IAppConfig for explanation about lazy loading
357
-	 * @see setValueString()
358
-	 * @see setValueInt()
359
-	 * @see setValueFloat()
360
-	 * @see setValueArray()
361
-	 */
362
-	public function setValueBool(string $app, string $key, bool $value, bool $lazy = false): bool;
363
-
364
-	/**
365
-	 * Store a config key and its value in database
366
-	 *
367
-	 * If config key is already known with the exact same config value, the database is not updated.
368
-	 * If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded.
369
-	 *
370
-	 * If config value was previously stored as sensitive or lazy loaded, status cannot be altered without using {@see deleteKey()} first
371
-	 *
372
-	 * @param string $app id of the app
373
-	 * @param string $key config key
374
-	 * @param array $value config value
375
-	 * @param bool $sensitive if TRUE value will be hidden when listing config values.
376
-	 * @param bool $lazy set config as lazy loaded
377
-	 *
378
-	 * @return bool TRUE if value was different, therefor updated in database
379
-	 * @since 29.0.0
380
-	 * @see IAppConfig for explanation about lazy loading
381
-	 * @see setValueString()
382
-	 * @see setValueInt()
383
-	 * @see setValueFloat()
384
-	 * @see setValueBool()
385
-	 */
386
-	public function setValueArray(string $app, string $key, array $value, bool $lazy = false, bool $sensitive = false): bool;
387
-
388
-	/**
389
-	 * switch sensitive status of a config value
390
-	 *
391
-	 * **WARNING:** ignore lazy filtering, all config values are loaded from database
392
-	 *
393
-	 * @param string $app id of the app
394
-	 * @param string $key config key
395
-	 * @param bool $sensitive TRUE to set as sensitive, FALSE to unset
396
-	 *
397
-	 * @return bool TRUE if database update were necessary
398
-	 * @since 29.0.0
399
-	 */
400
-	public function updateSensitive(string $app, string $key, bool $sensitive): bool;
401
-
402
-	/**
403
-	 * switch lazy loading status of a config value
404
-	 *
405
-	 * @param string $app id of the app
406
-	 * @param string $key config key
407
-	 * @param bool $lazy TRUE to set as lazy loaded, FALSE to unset
408
-	 *
409
-	 * @return bool TRUE if database update was necessary
410
-	 * @since 29.0.0
411
-	 */
412
-	public function updateLazy(string $app, string $key, bool $lazy): bool;
413
-
414
-	/**
415
-	 * returns an array contains details about a config value
416
-	 *
417
-	 * ```
418
-	 * [
419
-	 *   "app" => "myapp",
420
-	 *   "key" => "mykey",
421
-	 *   "value" => "its_value",
422
-	 *   "lazy" => false,
423
-	 *   "type" => 4,
424
-	 *   "typeString" => "string",
425
-	 *   'sensitive' => true
426
-	 * ]
427
-	 * ```
428
-	 *
429
-	 * @param string $app id of the app
430
-	 * @param string $key config key
431
-	 *
432
-	 * @return array
433
-	 * @throws AppConfigUnknownKeyException if config key is not known in database
434
-	 * @since 29.0.0
435
-	 */
436
-	public function getDetails(string $app, string $key): array;
437
-
438
-	/**
439
-	 * Convert string like 'string', 'integer', 'float', 'bool' or 'array' to
440
-	 * to bitflag {@see VALUE_STRING}, {@see VALUE_INT}, {@see VALUE_FLOAT},
441
-	 * {@see VALUE_BOOL} and {@see VALUE_ARRAY}
442
-	 *
443
-	 * @param string $type
444
-	 *
445
-	 * @return int
446
-	 * @since 29.0.0
447
-	 */
448
-	public function convertTypeToInt(string $type): int;
449
-
450
-	/**
451
-	 * Convert bitflag {@see VALUE_STRING}, {@see VALUE_INT}, {@see VALUE_FLOAT},
452
-	 * {@see VALUE_BOOL} and {@see VALUE_ARRAY} to human-readable string
453
-	 *
454
-	 * @param int $type
455
-	 *
456
-	 * @return string
457
-	 * @since 29.0.0
458
-	 */
459
-	public function convertTypeToString(int $type): string;
460
-
461
-	/**
462
-	 * Delete single config key from database.
463
-	 *
464
-	 * @param string $app id of the app
465
-	 * @param string $key config key
466
-	 * @since 29.0.0
467
-	 */
468
-	public function deleteKey(string $app, string $key): void;
469
-
470
-	/**
471
-	 * delete all config keys linked to an app
472
-	 *
473
-	 * @param string $app id of the app
474
-	 * @since 29.0.0
475
-	 */
476
-	public function deleteApp(string $app): void;
477
-
478
-	/**
479
-	 * Clear the cache.
480
-	 *
481
-	 * The cache will be rebuilt only the next time a config value is requested.
482
-	 *
483
-	 * @param bool $reload set to TRUE to refill cache instantly after clearing it
484
-	 * @since 29.0.0
485
-	 */
486
-	public function clearCache(bool $reload = false): void;
487
-
488
-	/**
489
-	 * get multiply values, either the app or key can be used as wildcard by setting it to false
490
-	 *
491
-	 * @param string|false $key
492
-	 * @param string|false $app
493
-	 *
494
-	 * @return array|false
495
-	 * @since 7.0.0
496
-	 * @deprecated 29.0.0 Use {@see getAllValues()} or {@see searchValues()}
497
-	 */
498
-	public function getValues($app, $key);
499
-
500
-	/**
501
-	 * get all values of the app or and filters out sensitive data
502
-	 *
503
-	 * @param string $app
504
-	 *
505
-	 * @return array
506
-	 * @since 12.0.0
507
-	 * @deprecated 29.0.0 Use {@see getAllValues()} or {@see searchValues()}
508
-	 */
509
-	public function getFilteredValues($app);
510
-
511
-	/**
512
-	 * Returns the installed version of all apps
513
-	 *
514
-	 * @return array<string, string>
515
-	 * @since 32.0.0
516
-	 */
517
-	public function getAppInstalledVersions(bool $onlyEnabled = false): array;
33
+    /** @since 29.0.0 */
34
+    public const VALUE_SENSITIVE = 1;
35
+    /** @since 29.0.0 */
36
+    public const VALUE_MIXED = 2;
37
+    /** @since 29.0.0 */
38
+    public const VALUE_STRING = 4;
39
+    /** @since 29.0.0 */
40
+    public const VALUE_INT = 8;
41
+    /** @since 29.0.0 */
42
+    public const VALUE_FLOAT = 16;
43
+    /** @since 29.0.0 */
44
+    public const VALUE_BOOL = 32;
45
+    /** @since 29.0.0 */
46
+    public const VALUE_ARRAY = 64;
47
+
48
+    /** @since 31.0.0 */
49
+    public const FLAG_SENSITIVE = 1;   // value is sensitive
50
+
51
+    /**
52
+     * Get list of all apps that have at least one config value stored in database
53
+     *
54
+     * **WARNING:** ignore lazy filtering, all config values are loaded from database
55
+     *
56
+     * @return list<string> list of app ids
57
+     * @since 7.0.0
58
+     */
59
+    public function getApps(): array;
60
+
61
+    /**
62
+     * Returns all keys stored in database, related to an app.
63
+     * Please note that the values are not returned.
64
+     *
65
+     * **WARNING:** ignore lazy filtering, all config values are loaded from database
66
+     *
67
+     * @param string $app id of the app
68
+     *
69
+     * @return list<string> list of stored config keys
70
+     * @since 29.0.0
71
+     */
72
+    public function getKeys(string $app): array;
73
+
74
+    /**
75
+     * Check if a key exists in the list of stored config values.
76
+     *
77
+     * @param string $app id of the app
78
+     * @param string $key config key
79
+     * @param bool $lazy search within lazy loaded config
80
+     *
81
+     * @return bool TRUE if key exists
82
+     * @since 29.0.0 Added the $lazy argument
83
+     * @since 7.0.0
84
+     */
85
+    public function hasKey(string $app, string $key, ?bool $lazy = false): bool;
86
+
87
+    /**
88
+     * best way to see if a value is set as sensitive (not displayed in report)
89
+     *
90
+     * @param string $app id of the app
91
+     * @param string $key config key
92
+     * @param bool|null $lazy search within lazy loaded config
93
+     *
94
+     * @return bool TRUE if value is sensitive
95
+     * @throws AppConfigUnknownKeyException if config key is not known
96
+     * @since 29.0.0
97
+     */
98
+    public function isSensitive(string $app, string $key, ?bool $lazy = false): bool;
99
+
100
+    /**
101
+     * Returns if the config key stored in database is lazy loaded
102
+     *
103
+     * **WARNING:** ignore lazy filtering, all config values are loaded from database
104
+     *
105
+     * @param string $app id of the app
106
+     * @param string $key config key
107
+     *
108
+     * @return bool TRUE if config is lazy loaded
109
+     * @throws AppConfigUnknownKeyException if config key is not known
110
+     * @see IAppConfig for details about lazy loading
111
+     * @since 29.0.0
112
+     */
113
+    public function isLazy(string $app, string $key): bool;
114
+
115
+    /**
116
+     * List all config values from an app with config key starting with $key.
117
+     * Returns an array with config key as key, stored value as value.
118
+     *
119
+     * **WARNING:** ignore lazy filtering, all config values are loaded from database
120
+     *
121
+     * @param string $app id of the app
122
+     * @param string $prefix config keys prefix to search, can be empty.
123
+     * @param bool $filtered filter sensitive config values
124
+     *
125
+     * @return array<string, string|int|float|bool|array> [configKey => configValue]
126
+     * @since 29.0.0
127
+     */
128
+    public function getAllValues(string $app, string $prefix = '', bool $filtered = false): array;
129
+
130
+    /**
131
+     * List all apps storing a specific config key and its stored value.
132
+     * Returns an array with appId as key, stored value as value.
133
+     *
134
+     * @param string $key config key
135
+     * @param bool $lazy search within lazy loaded config
136
+     * @param int|null $typedAs enforce type for the returned values {@see self::VALUE_STRING} and others
137
+     *
138
+     * @return array<string, string|int|float|bool|array> [appId => configValue]
139
+     * @since 29.0.0
140
+     */
141
+    public function searchValues(string $key, bool $lazy = false, ?int $typedAs = null): array;
142
+
143
+    /**
144
+     * Get config value assigned to a config key.
145
+     * If config key is not found in database, default value is returned.
146
+     * If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE.
147
+     *
148
+     * @param string $app id of the app
149
+     * @param string $key config key
150
+     * @param string $default default value
151
+     * @param bool $lazy search within lazy loaded config
152
+     *
153
+     * @return string stored config value or $default if not set in database
154
+     * @since 29.0.0
155
+     * @see IAppConfig for explanation about lazy loading
156
+     * @see getValueInt()
157
+     * @see getValueFloat()
158
+     * @see getValueBool()
159
+     * @see getValueArray()
160
+     */
161
+    public function getValueString(string $app, string $key, string $default = '', bool $lazy = false): string;
162
+
163
+    /**
164
+     * Get config value assigned to a config key.
165
+     * If config key is not found in database, default value is returned.
166
+     * If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE.
167
+     *
168
+     * @param string $app id of the app
169
+     * @param string $key config key
170
+     * @param int $default default value
171
+     * @param bool $lazy search within lazy loaded config
172
+     *
173
+     * @return int stored config value or $default if not set in database
174
+     * @since 29.0.0
175
+     * @see IAppConfig for explanation about lazy loading
176
+     * @see getValueString()
177
+     * @see getValueFloat()
178
+     * @see getValueBool()
179
+     * @see getValueArray()
180
+     */
181
+    public function getValueInt(string $app, string $key, int $default = 0, bool $lazy = false): int;
182
+
183
+    /**
184
+     * Get config value assigned to a config key.
185
+     * If config key is not found in database, default value is returned.
186
+     * If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE.
187
+     *
188
+     * @param string $app id of the app
189
+     * @param string $key config key
190
+     * @param float $default default value
191
+     * @param bool $lazy search within lazy loaded config
192
+     *
193
+     * @return float stored config value or $default if not set in database
194
+     * @since 29.0.0
195
+     * @see IAppConfig for explanation about lazy loading
196
+     * @see getValueString()
197
+     * @see getValueInt()
198
+     * @see getValueBool()
199
+     * @see getValueArray()
200
+     */
201
+    public function getValueFloat(string $app, string $key, float $default = 0, bool $lazy = false): float;
202
+
203
+    /**
204
+     * Get config value assigned to a config key.
205
+     * If config key is not found in database, default value is returned.
206
+     * If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE.
207
+     *
208
+     * @param string $app id of the app
209
+     * @param string $key config key
210
+     * @param bool $default default value
211
+     * @param bool $lazy search within lazy loaded config
212
+     *
213
+     * @return bool stored config value or $default if not set in database
214
+     * @since 29.0.0
215
+     * @see IAppConfig for explanation about lazy loading
216
+     * @see getValueString()
217
+     * @see getValueInt()
218
+     * @see getValueFloat()
219
+     * @see getValueArray()
220
+     */
221
+    public function getValueBool(string $app, string $key, bool $default = false, bool $lazy = false): bool;
222
+
223
+    /**
224
+     * Get config value assigned to a config key.
225
+     * If config key is not found in database, default value is returned.
226
+     * If config key is set as lazy loaded, the $lazy argument needs to be set to TRUE.
227
+     *
228
+     * @param string $app id of the app
229
+     * @param string $key config key
230
+     * @param array $default default value
231
+     * @param bool $lazy search within lazy loaded config
232
+     *
233
+     * @return array stored config value or $default if not set in database
234
+     * @since 29.0.0
235
+     * @see IAppConfig for explanation about lazy loading
236
+     * @see getValueString()
237
+     * @see getValueInt()
238
+     * @see getValueFloat()
239
+     * @see getValueBool()
240
+     */
241
+    public function getValueArray(string $app, string $key, array $default = [], bool $lazy = false): array;
242
+
243
+    /**
244
+     * returns the type of config value
245
+     *
246
+     * **WARNING:** ignore lazy filtering, all config values are loaded from database
247
+     *              unless lazy is set to false
248
+     *
249
+     * @param string $app id of the app
250
+     * @param string $key config key
251
+     * @param bool|null $lazy
252
+     *
253
+     * @return int
254
+     * @throws AppConfigUnknownKeyException
255
+     * @since 29.0.0
256
+     * @see VALUE_STRING
257
+     * @see VALUE_INT
258
+     * @see VALUE_FLOAT
259
+     * @see VALUE_BOOL
260
+     * @see VALUE_ARRAY
261
+     */
262
+    public function getValueType(string $app, string $key, ?bool $lazy = null): int;
263
+
264
+    /**
265
+     * Store a config key and its value in database
266
+     *
267
+     * If config key is already known with the exact same config value, the database is not updated.
268
+     * If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded.
269
+     *
270
+     * If config value was previously stored as sensitive or lazy loaded, status cannot be altered without using {@see deleteKey()} first
271
+     *
272
+     * @param string $app id of the app
273
+     * @param string $key config key
274
+     * @param string $value config value
275
+     * @param bool $sensitive if TRUE value will be hidden when listing config values.
276
+     * @param bool $lazy set config as lazy loaded
277
+     *
278
+     * @return bool TRUE if value was different, therefor updated in database
279
+     * @since 29.0.0
280
+     * @see IAppConfig for explanation about lazy loading
281
+     * @see setValueInt()
282
+     * @see setValueFloat()
283
+     * @see setValueBool()
284
+     * @see setValueArray()
285
+     */
286
+    public function setValueString(string $app, string $key, string $value, bool $lazy = false, bool $sensitive = false): bool;
287
+
288
+    /**
289
+     * Store a config key and its value in database
290
+     *
291
+     * When handling huge value around and/or above 2,147,483,647, a debug log will be generated
292
+     * on 64bits system, as php int type reach its limit (and throw an exception) on 32bits when using huge numbers.
293
+     *
294
+     * When using huge numbers, it is advised to use {@see \OCP\Util::numericToNumber()} and {@see setValueString()}
295
+     *
296
+     * If config key is already known with the exact same config value, the database is not updated.
297
+     * If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded.
298
+     *
299
+     * If config value was previously stored as sensitive or lazy loaded, status cannot be altered without using {@see deleteKey()} first
300
+     *
301
+     * @param string $app id of the app
302
+     * @param string $key config key
303
+     * @param int $value config value
304
+     * @param bool $sensitive if TRUE value will be hidden when listing config values.
305
+     * @param bool $lazy set config as lazy loaded
306
+     *
307
+     * @return bool TRUE if value was different, therefor updated in database
308
+     * @since 29.0.0
309
+     * @see IAppConfig for explanation about lazy loading
310
+     * @see setValueString()
311
+     * @see setValueFloat()
312
+     * @see setValueBool()
313
+     * @see setValueArray()
314
+     */
315
+    public function setValueInt(string $app, string $key, int $value, bool $lazy = false, bool $sensitive = false): bool;
316
+
317
+    /**
318
+     * Store a config key and its value in database.
319
+     *
320
+     * If config key is already known with the exact same config value, the database is not updated.
321
+     * If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded.
322
+     *
323
+     * If config value was previously stored as sensitive or lazy loaded, status cannot be altered without using {@see deleteKey()} first
324
+     *
325
+     * @param string $app id of the app
326
+     * @param string $key config key
327
+     * @param float $value config value
328
+     * @param bool $sensitive if TRUE value will be hidden when listing config values.
329
+     * @param bool $lazy set config as lazy loaded
330
+     *
331
+     * @return bool TRUE if value was different, therefor updated in database
332
+     * @since 29.0.0
333
+     * @see IAppConfig for explanation about lazy loading
334
+     * @see setValueString()
335
+     * @see setValueInt()
336
+     * @see setValueBool()
337
+     * @see setValueArray()
338
+     */
339
+    public function setValueFloat(string $app, string $key, float $value, bool $lazy = false, bool $sensitive = false): bool;
340
+
341
+    /**
342
+     * Store a config key and its value in database
343
+     *
344
+     * If config key is already known with the exact same config value, the database is not updated.
345
+     * If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded.
346
+     *
347
+     * If config value was previously stored as lazy loaded, status cannot be altered without using {@see deleteKey()} first
348
+     *
349
+     * @param string $app id of the app
350
+     * @param string $key config key
351
+     * @param bool $value config value
352
+     * @param bool $lazy set config as lazy loaded
353
+     *
354
+     * @return bool TRUE if value was different, therefor updated in database
355
+     * @since 29.0.0
356
+     * @see IAppConfig for explanation about lazy loading
357
+     * @see setValueString()
358
+     * @see setValueInt()
359
+     * @see setValueFloat()
360
+     * @see setValueArray()
361
+     */
362
+    public function setValueBool(string $app, string $key, bool $value, bool $lazy = false): bool;
363
+
364
+    /**
365
+     * Store a config key and its value in database
366
+     *
367
+     * If config key is already known with the exact same config value, the database is not updated.
368
+     * If config key is not supposed to be read during the boot of the cloud, it is advised to set it as lazy loaded.
369
+     *
370
+     * If config value was previously stored as sensitive or lazy loaded, status cannot be altered without using {@see deleteKey()} first
371
+     *
372
+     * @param string $app id of the app
373
+     * @param string $key config key
374
+     * @param array $value config value
375
+     * @param bool $sensitive if TRUE value will be hidden when listing config values.
376
+     * @param bool $lazy set config as lazy loaded
377
+     *
378
+     * @return bool TRUE if value was different, therefor updated in database
379
+     * @since 29.0.0
380
+     * @see IAppConfig for explanation about lazy loading
381
+     * @see setValueString()
382
+     * @see setValueInt()
383
+     * @see setValueFloat()
384
+     * @see setValueBool()
385
+     */
386
+    public function setValueArray(string $app, string $key, array $value, bool $lazy = false, bool $sensitive = false): bool;
387
+
388
+    /**
389
+     * switch sensitive status of a config value
390
+     *
391
+     * **WARNING:** ignore lazy filtering, all config values are loaded from database
392
+     *
393
+     * @param string $app id of the app
394
+     * @param string $key config key
395
+     * @param bool $sensitive TRUE to set as sensitive, FALSE to unset
396
+     *
397
+     * @return bool TRUE if database update were necessary
398
+     * @since 29.0.0
399
+     */
400
+    public function updateSensitive(string $app, string $key, bool $sensitive): bool;
401
+
402
+    /**
403
+     * switch lazy loading status of a config value
404
+     *
405
+     * @param string $app id of the app
406
+     * @param string $key config key
407
+     * @param bool $lazy TRUE to set as lazy loaded, FALSE to unset
408
+     *
409
+     * @return bool TRUE if database update was necessary
410
+     * @since 29.0.0
411
+     */
412
+    public function updateLazy(string $app, string $key, bool $lazy): bool;
413
+
414
+    /**
415
+     * returns an array contains details about a config value
416
+     *
417
+     * ```
418
+     * [
419
+     *   "app" => "myapp",
420
+     *   "key" => "mykey",
421
+     *   "value" => "its_value",
422
+     *   "lazy" => false,
423
+     *   "type" => 4,
424
+     *   "typeString" => "string",
425
+     *   'sensitive' => true
426
+     * ]
427
+     * ```
428
+     *
429
+     * @param string $app id of the app
430
+     * @param string $key config key
431
+     *
432
+     * @return array
433
+     * @throws AppConfigUnknownKeyException if config key is not known in database
434
+     * @since 29.0.0
435
+     */
436
+    public function getDetails(string $app, string $key): array;
437
+
438
+    /**
439
+     * Convert string like 'string', 'integer', 'float', 'bool' or 'array' to
440
+     * to bitflag {@see VALUE_STRING}, {@see VALUE_INT}, {@see VALUE_FLOAT},
441
+     * {@see VALUE_BOOL} and {@see VALUE_ARRAY}
442
+     *
443
+     * @param string $type
444
+     *
445
+     * @return int
446
+     * @since 29.0.0
447
+     */
448
+    public function convertTypeToInt(string $type): int;
449
+
450
+    /**
451
+     * Convert bitflag {@see VALUE_STRING}, {@see VALUE_INT}, {@see VALUE_FLOAT},
452
+     * {@see VALUE_BOOL} and {@see VALUE_ARRAY} to human-readable string
453
+     *
454
+     * @param int $type
455
+     *
456
+     * @return string
457
+     * @since 29.0.0
458
+     */
459
+    public function convertTypeToString(int $type): string;
460
+
461
+    /**
462
+     * Delete single config key from database.
463
+     *
464
+     * @param string $app id of the app
465
+     * @param string $key config key
466
+     * @since 29.0.0
467
+     */
468
+    public function deleteKey(string $app, string $key): void;
469
+
470
+    /**
471
+     * delete all config keys linked to an app
472
+     *
473
+     * @param string $app id of the app
474
+     * @since 29.0.0
475
+     */
476
+    public function deleteApp(string $app): void;
477
+
478
+    /**
479
+     * Clear the cache.
480
+     *
481
+     * The cache will be rebuilt only the next time a config value is requested.
482
+     *
483
+     * @param bool $reload set to TRUE to refill cache instantly after clearing it
484
+     * @since 29.0.0
485
+     */
486
+    public function clearCache(bool $reload = false): void;
487
+
488
+    /**
489
+     * get multiply values, either the app or key can be used as wildcard by setting it to false
490
+     *
491
+     * @param string|false $key
492
+     * @param string|false $app
493
+     *
494
+     * @return array|false
495
+     * @since 7.0.0
496
+     * @deprecated 29.0.0 Use {@see getAllValues()} or {@see searchValues()}
497
+     */
498
+    public function getValues($app, $key);
499
+
500
+    /**
501
+     * get all values of the app or and filters out sensitive data
502
+     *
503
+     * @param string $app
504
+     *
505
+     * @return array
506
+     * @since 12.0.0
507
+     * @deprecated 29.0.0 Use {@see getAllValues()} or {@see searchValues()}
508
+     */
509
+    public function getFilteredValues($app);
510
+
511
+    /**
512
+     * Returns the installed version of all apps
513
+     *
514
+     * @return array<string, string>
515
+     * @since 32.0.0
516
+     */
517
+    public function getAppInstalledVersions(bool $onlyEnabled = false): array;
518 518
 }
Please login to merge, or discard this patch.
lib/public/Route/IRoute.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -13,90 +13,90 @@
 block discarded – undo
13 13
  * @since 7.0.0
14 14
  */
15 15
 interface IRoute {
16
-	/**
17
-	 * Specify PATCH as the method to use with this route
18
-	 * @return \OCP\Route\IRoute
19
-	 * @since 7.0.0
20
-	 */
21
-	public function patch();
16
+    /**
17
+     * Specify PATCH as the method to use with this route
18
+     * @return \OCP\Route\IRoute
19
+     * @since 7.0.0
20
+     */
21
+    public function patch();
22 22
 
23
-	/**
24
-	 * Specify the method when this route is to be used
25
-	 *
26
-	 * @param string $method HTTP method (uppercase)
27
-	 * @return \OCP\Route\IRoute
28
-	 * @since 7.0.0
29
-	 */
30
-	public function method($method);
23
+    /**
24
+     * Specify the method when this route is to be used
25
+     *
26
+     * @param string $method HTTP method (uppercase)
27
+     * @return \OCP\Route\IRoute
28
+     * @since 7.0.0
29
+     */
30
+    public function method($method);
31 31
 
32
-	/**
33
-	 * The action to execute when this route matches, includes a file like
34
-	 * it is called directly
35
-	 *
36
-	 * @param string $file
37
-	 * @return $this
38
-	 * @since 7.0.0
39
-	 * @deprecated 32.0.0 Use a proper controller instead
40
-	 */
41
-	public function actionInclude($file);
32
+    /**
33
+     * The action to execute when this route matches, includes a file like
34
+     * it is called directly
35
+     *
36
+     * @param string $file
37
+     * @return $this
38
+     * @since 7.0.0
39
+     * @deprecated 32.0.0 Use a proper controller instead
40
+     */
41
+    public function actionInclude($file);
42 42
 
43
-	/**
44
-	 * Specify GET as the method to use with this route
45
-	 * @return \OCP\Route\IRoute
46
-	 * @since 7.0.0
47
-	 */
48
-	public function get();
43
+    /**
44
+     * Specify GET as the method to use with this route
45
+     * @return \OCP\Route\IRoute
46
+     * @since 7.0.0
47
+     */
48
+    public function get();
49 49
 
50
-	/**
51
-	 * Specify POST as the method to use with this route
52
-	 * @return \OCP\Route\IRoute
53
-	 * @since 7.0.0
54
-	 */
55
-	public function post();
50
+    /**
51
+     * Specify POST as the method to use with this route
52
+     * @return \OCP\Route\IRoute
53
+     * @since 7.0.0
54
+     */
55
+    public function post();
56 56
 
57
-	/**
58
-	 * Specify DELETE as the method to use with this route
59
-	 * @return \OCP\Route\IRoute
60
-	 * @since 7.0.0
61
-	 */
62
-	public function delete();
57
+    /**
58
+     * Specify DELETE as the method to use with this route
59
+     * @return \OCP\Route\IRoute
60
+     * @since 7.0.0
61
+     */
62
+    public function delete();
63 63
 
64
-	/**
65
-	 * The action to execute when this route matches
66
-	 *
67
-	 * @param string|callable $class the class or a callable
68
-	 * @param string $function the function to use with the class
69
-	 * @return \OCP\Route\IRoute
70
-	 *
71
-	 * This function is called with $class set to a callable or
72
-	 * to the class with $function
73
-	 * @since 7.0.0
74
-	 * @deprecated 32.0.0 Use a proper controller instead
75
-	 */
76
-	public function action($class, $function = null);
64
+    /**
65
+     * The action to execute when this route matches
66
+     *
67
+     * @param string|callable $class the class or a callable
68
+     * @param string $function the function to use with the class
69
+     * @return \OCP\Route\IRoute
70
+     *
71
+     * This function is called with $class set to a callable or
72
+     * to the class with $function
73
+     * @since 7.0.0
74
+     * @deprecated 32.0.0 Use a proper controller instead
75
+     */
76
+    public function action($class, $function = null);
77 77
 
78
-	/**
79
-	 * Defaults to use for this route
80
-	 *
81
-	 * @param array $defaults The defaults
82
-	 * @return \OCP\Route\IRoute
83
-	 * @since 7.0.0
84
-	 */
85
-	public function defaults($defaults);
78
+    /**
79
+     * Defaults to use for this route
80
+     *
81
+     * @param array $defaults The defaults
82
+     * @return \OCP\Route\IRoute
83
+     * @since 7.0.0
84
+     */
85
+    public function defaults($defaults);
86 86
 
87
-	/**
88
-	 * Requirements for this route
89
-	 *
90
-	 * @param array $requirements The requirements
91
-	 * @return \OCP\Route\IRoute
92
-	 * @since 7.0.0
93
-	 */
94
-	public function requirements($requirements);
87
+    /**
88
+     * Requirements for this route
89
+     *
90
+     * @param array $requirements The requirements
91
+     * @return \OCP\Route\IRoute
92
+     * @since 7.0.0
93
+     */
94
+    public function requirements($requirements);
95 95
 
96
-	/**
97
-	 * Specify PUT as the method to use with this route
98
-	 * @return \OCP\Route\IRoute
99
-	 * @since 7.0.0
100
-	 */
101
-	public function put();
96
+    /**
97
+     * Specify PUT as the method to use with this route
98
+     * @return \OCP\Route\IRoute
99
+     * @since 7.0.0
100
+     */
101
+    public function put();
102 102
 }
Please login to merge, or discard this patch.