@@ -312,14 +312,14 @@ public function setUserValue($userId, $appName, $key, $value, $preCondition = nu
312312 /**
313313 * Getting a user defined value
314314 *
315- * @param string $userId the userId of the user that we want to store the value under
315+ * @param ? string $userId the userId of the user that we want to store the value under
316316 * @param string $appName the appName that we stored the value under
317317 * @param string $key the key under which the value is being stored
318318 * @param mixed $default the default value to be returned if the value isn't set
319319 * @return string
320320 */
321321 public function getUserValue ($ userId , $ appName , $ key , $ default = '' ) {
322- $ data = $ this ->getUserValues ($ userId );
322+ $ data = $ this ->getAllUserValues ($ userId );
323323 if (isset ($ data [$ appName ][$ key ])) {
324324 return $ data [$ appName ][$ key ];
325325 } else {
@@ -335,7 +335,7 @@ public function getUserValue($userId, $appName, $key, $default = '') {
335335 * @return string[]
336336 */
337337 public function getUserKeys ($ userId , $ appName ) {
338- $ data = $ this ->getUserValues ($ userId );
338+ $ data = $ this ->getAllUserValues ($ userId );
339339 if (isset ($ data [$ appName ])) {
340340 return array_keys ($ data [$ appName ]);
341341 } else {
@@ -400,19 +400,20 @@ public function deleteAppFromAllUsers($appName) {
400400 /**
401401 * Returns all user configs sorted by app of one user
402402 *
403- * @param string $userId the user ID to get the app configs from
403+ * @param ?string $userId the user ID to get the app configs from
404+ * @psalm-return array<string, array<string, string>>
404405 * @return array[] - 2 dimensional array with the following structure:
405406 * [ $appId =>
406407 * [ $key => $value ]
407408 * ]
408409 */
409- private function getUserValues ( $ userId ) {
410+ public function getAllUserValues (? string $ userId ): array {
410411 if (isset ($ this ->userCache [$ userId ])) {
411412 return $ this ->userCache [$ userId ];
412413 }
413414 if ($ userId === null || $ userId === '' ) {
414- $ this ->userCache [$ userId ] = [];
415- return $ this ->userCache [$ userId ];
415+ $ this ->userCache ['' ] = [];
416+ return $ this ->userCache ['' ];
416417 }
417418
418419 // TODO - FIXME
0 commit comments