CustomVariableArray: move renderArray to config helper

This commit is contained in:
Thomas Gelf 2015-06-15 14:32:35 +02:00
parent 774957cfe7
commit 212a36a858
2 changed files with 15 additions and 8 deletions

View File

@ -37,13 +37,6 @@ class CustomVariableArray extends CustomVariable
public function toConfigString()
{
$str = '[ ' . implode(', ', $this->value) . ' ]';
if (strlen($str) < 60) {
return $str;
}
// Prefix for toConfigString?
return "[\n " . implode(",\n ", $this->value) . "\n]";
return c::renderArray($this->value);
}
}

View File

@ -92,6 +92,20 @@ class IcingaConfigHelper
return '"' . $string . '"';
}
// Requires an array of CustomVariable objects
public static function renderArray($array)
{
$str = '[ ' . implode(', ', $array) . ' ]';
if (strlen($str) < 60) {
return $str;
}
// Prefix for toConfigString?
return "[\n " . implode(",\n ", $array) . "\n]";
}
public static function isReserved($string)
{
return in_array($string, self::$reservedWords);