CustomVariableArray: move renderArray to config helper
This commit is contained in:
parent
774957cfe7
commit
212a36a858
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue