2015-10-16 18:36:43 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\IcingaConfig;
|
|
|
|
|
2018-06-04 17:46:47 +02:00
|
|
|
use InvalidArgumentException;
|
2015-10-16 18:36:43 +02:00
|
|
|
|
|
|
|
class IcingaConfigRendered implements IcingaConfigRenderer
|
|
|
|
{
|
|
|
|
protected $rendered;
|
|
|
|
|
|
|
|
public function __construct($string)
|
|
|
|
{
|
|
|
|
if (! is_string($string)) {
|
2018-06-04 17:46:47 +02:00
|
|
|
throw new InvalidArgumentException('IcingaConfigRendered accepts only strings');
|
2015-10-16 18:36:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->rendered = $string;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function toConfigString()
|
|
|
|
{
|
|
|
|
return $this->rendered;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function __toString()
|
|
|
|
{
|
|
|
|
return $this->toConfigString();
|
|
|
|
}
|
2016-10-14 15:40:48 +02:00
|
|
|
|
|
|
|
public function toLegacyConfigString()
|
|
|
|
{
|
|
|
|
return $this->rendered;
|
|
|
|
}
|
2015-10-16 18:36:43 +02:00
|
|
|
}
|