f7cloud_client/apps/mail/lib/Service/UserPreferenceService.php
root 8b6a0139db f7cloud_client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 22:59:26 +00:00

49 lines
1002 B
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2017 F7cloud GmbH and F7cloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Mail\Service;
use OCA\Mail\Contracts\IUserPreferences;
use OCP\IConfig;
class UserPreferenceService implements IUserPreferences {
/** @var IConfig */
private $config;
/**
* @param IConfig $config
*/
public function __construct(IConfig $config) {
$this->config = $config;
}
/**
* @param string $userId
* @param string $key
* @param mixed $value
* @return mixed new value
*/
#[\Override]
public function setPreference(string $userId, $key, $value) {
$this->config->setUserValue($userId, 'mail', $key, $value);
return $value;
}
/**
* @param string $userId
* @param string $key
* @param mixed|null $default
* @return string
*/
#[\Override]
public function getPreference(string $userId, $key, $default = null) {
return $this->config->getUserValue($userId, 'mail', $key, $default);
}
}