]> git.mxchange.org Git - friendica.git/commitdiff
Apply suggestions from code review
authorPhilipp <admin+Github@philipp.info>
Mon, 2 Jan 2023 01:25:41 +0000 (02:25 +0100)
committerPhilipp <admin@philipp.info>
Tue, 3 Jan 2023 13:22:06 +0000 (14:22 +0100)
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
src/Core/Config/Model/Config.php
src/Core/Config/Util/ConfigFileManager.php
src/Core/Config/ValueObject/Cache.php

index 3de97158f2c449ba581826a261fd072d453a5e20..7829b75ffd905221878b328cd5e32443cd2dc77a 100644 (file)
@@ -32,9 +32,7 @@ use Friendica\Core\Config\ValueObject\Cache;
  */
 class Config implements IManageConfigValues
 {
-       /**
-        * @var Cache
-        */
+       /** @var Cache */
        protected $configCache;
 
        /** @var ConfigFileManager */
index 82de4a99cbef5b1d73b8d38b53eb5162b7fa2492..378d7fbd4ef8921637ef064f44111d3cc79baca7 100644 (file)
@@ -401,7 +401,7 @@ class ConfigFileManager
        private function loadConfigFile(string $filepath): array
        {
                if (file_exists($filepath)) {
-                       $config = include($filepath);
+                       $config = include $filepath;
 
                        if (!is_array($config)) {
                                throw new ConfigFileException('Error loading config file ' . $filepath);
index 2bac625ad2a8d9b87da6cbe5283aa8b7276948ec..a074414bfc616d9334cec7dfcbecdc71ac25392e 100644 (file)
@@ -212,13 +212,10 @@ class Cache
                        return null;
                }
 
-               switch (true) {
-                       // manage array value
-                       case preg_match("|^a:[0-9]+:{.*}$|s", $value):
-                               return unserialize($value);
-
-                       default:
-                               return $value;
+               if (preg_match("|^a:[0-9]+:{.*}$|s", $value)) {
+                       return unserialize($value);
+               } else {
+                       return $value;
                }
        }