address Codacy issues

This commit is contained in:
El RIDO 2021-06-13 10:53:01 +02:00
parent 93135e0abf
commit 1f2dddd9d8
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
4 changed files with 15 additions and 24 deletions

View file

@ -447,9 +447,9 @@ class Database extends AbstractData
public function setValue($value, $namespace, $key = '')
{
if ($namespace === 'traffic_limiter') {
self::$_traffic_limiter_cache[$key] = $value;
self::$_last_cache[$key] = $value;
try {
$value = Json::encode(self::$_traffic_limiter_cache);
$value = Json::encode(self::$_last_cache);
} catch (Exception $e) {
return false;
}
@ -492,12 +492,12 @@ class Database extends AbstractData
}
if ($value && $namespace === 'traffic_limiter') {
try {
self::$_traffic_limiter_cache = Json::decode($value);
self::$_last_cache = Json::decode($value);
} catch (Exception $e) {
self::$_traffic_limiter_cache = array();
self::$_last_cache = array();
}
if (array_key_exists($key, self::$_traffic_limiter_cache)) {
return self::$_traffic_limiter_cache[$key];
if (array_key_exists($key, self::$_last_cache)) {
return self::$_last_cache[$key];
}
}
return (string) $value;