* @param int $uid
* @param array $config
*/
- public function load(int $uid, array $config)
+ public function load($uid, array $config)
{
+ if (!is_int($uid)) {
+ return;
+ }
+
$categories = array_keys($config);
foreach ($categories as $category) {
*
* @return null|string The value of the config entry or null if not set
*/
- public function get(int $uid, string $cat, $key = null)
+ public function get($uid, string $cat, string $key = null)
{
+ if (!is_int($uid)) {
+ return null;
+ }
+
if (isset($this->config[$uid][$cat][$key])) {
return $this->config[$uid][$cat][$key];
} elseif (!isset($key) && isset($this->config[$uid][$cat])) {
*
* @return bool Set successful
*/
- public function set(int $uid, string $cat, string $key, $value)
+ public function set($uid, string $cat, string $key, $value)
{
+ if (!is_int($uid)) {
+ return false;
+ }
+
if (!isset($this->config[$uid]) || !is_array($this->config[$uid])) {
$this->config[$uid] = [];
}
*
* @return bool true, if deleted
*/
- public function delete(int $uid, string $cat, string $key)
+ public function delete($uid, string $cat, string $key)
{
+ if (!is_int($uid)) {
+ return false;
+ }
+
if (isset($this->config[$uid][$cat][$key])) {
unset($this->config[$uid][$cat][$key]);
if (count($this->config[$uid][$cat]) == 0) {