mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 09:14:09 +02:00
IcingaConfigHelper: introduce alreadyRendered()
This commit is contained in:
parent
371589a2a7
commit
249b849b08
@ -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);
|
||||
|
29
library/Director/IcingaConfig/IcingaConfigRendered.php
Normal file
29
library/Director/IcingaConfig/IcingaConfigRendered.php
Normal 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();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user