IcingaConfigHelper: introduce alreadyRendered()

This commit is contained in:
Thomas Gelf 2015-10-16 18:36:43 +02:00
parent 371589a2a7
commit 249b849b08
2 changed files with 34 additions and 0 deletions

View File

@ -126,6 +126,11 @@ class IcingaConfigHelper
}
public static function alreadyRendered($string)
{
return new IcingaConfigRendered($string);
}
public static function isReserved($string)
{
return in_array($string, self::$reservedWords);

View File

@ -0,0 +1,29 @@
<?php
namespace Icinga\Module\Director\IcingaConfig;
use Icinga\Exception\ProgrammingError;
class IcingaConfigRendered implements IcingaConfigRenderer
{
protected $rendered;
public function __construct($string)
{
if (! is_string($string)) {
throw new ProgrammingError('IcingaConfigRendered accepts only strings');
}
$this->rendered = $string;
}
public function toConfigString()
{
return $this->rendered;
}
public function __toString()
{
return $this->toConfigString();
}
}