Apply suggestions from code review
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
This commit is contained in:
parent
5ff1d431aa
commit
ae1533e312
|
@ -32,9 +32,7 @@ use Friendica\Core\Config\ValueObject\Cache;
|
||||||
*/
|
*/
|
||||||
class Config implements IManageConfigValues
|
class Config implements IManageConfigValues
|
||||||
{
|
{
|
||||||
/**
|
/** @var Cache */
|
||||||
* @var Cache
|
|
||||||
*/
|
|
||||||
protected $configCache;
|
protected $configCache;
|
||||||
|
|
||||||
/** @var ConfigFileManager */
|
/** @var ConfigFileManager */
|
||||||
|
|
|
@ -401,7 +401,7 @@ class ConfigFileManager
|
||||||
private function loadConfigFile(string $filepath): array
|
private function loadConfigFile(string $filepath): array
|
||||||
{
|
{
|
||||||
if (file_exists($filepath)) {
|
if (file_exists($filepath)) {
|
||||||
$config = include($filepath);
|
$config = include $filepath;
|
||||||
|
|
||||||
if (!is_array($config)) {
|
if (!is_array($config)) {
|
||||||
throw new ConfigFileException('Error loading config file ' . $filepath);
|
throw new ConfigFileException('Error loading config file ' . $filepath);
|
||||||
|
|
|
@ -212,13 +212,10 @@ class Cache
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (true) {
|
if (preg_match("|^a:[0-9]+:{.*}$|s", $value)) {
|
||||||
// manage array value
|
return unserialize($value);
|
||||||
case preg_match("|^a:[0-9]+:{.*}$|s", $value):
|
} else {
|
||||||
return unserialize($value);
|
return $value;
|
||||||
|
|
||||||
default:
|
|
||||||
return $value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue