3 namespace Friendica\Core\Config\Model;
8 * Formats a DB value to a config value
9 * - null = The db-value isn't set
10 * - bool = The db-value is either '0' or '1'
11 * - array = The db-value is a serialized array
12 * - string = The db-value is a string
14 * Keep in mind that there aren't any numeric/integer config values in the database
16 * @param null|string $value
18 * @return null|array|string
20 public static function toConfigValue($value)
28 case preg_match("|^a:[0-9]+:{.*}$|s", $value):
29 return unserialize($value);
37 * Formats a config value to a DB value (string)
43 public static function toDbValue($value): string
45 // if not set, save an empty string
52 case is_array($value):
53 return serialize($value);
56 return (string)$value;