From 2ea573e3388e10c14212b42b7aada96bbccaf017 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 7 Dec 2016 08:29:20 +0100 Subject: [PATCH] IcingaVar: use new CustomVar helpers --- library/Director/Objects/IcingaVar.php | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/library/Director/Objects/IcingaVar.php b/library/Director/Objects/IcingaVar.php index 45bf4a3c..f0fc549a 100644 --- a/library/Director/Objects/IcingaVar.php +++ b/library/Director/Objects/IcingaVar.php @@ -32,7 +32,7 @@ class IcingaVar extends DbObject */ public static function forCustomVar(CustomVariable $customVar, Db $db) { - $rendered = static::renderVar($customVar); + $rendered = $customVar->render(); $var = static::create(array( 'checksum' => $customVar->checksum(), @@ -47,24 +47,6 @@ class IcingaVar extends DbObject return $var; } - protected static function renderVar(CustomVariable $var) - { - $renderExpressions = false; // TODO! - return c::renderKeyValue( - static::renderKeyName($var->getKey()), - $var->toConfigStringPrefetchable($renderExpressions) - ); - } - - protected static function renderKeyName($key) - { - if (preg_match('/^[a-z0-9_]+\d*$/i', $key)) { - return 'vars.' . c::escapeIfReserved($key); - } else { - return 'vars[' . c::renderString($key) . ']'; - } - } - /** * @param CustomVariable $var * @param Db $db