2015-08-28 18:13:01 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\CustomVariable;
|
|
|
|
|
|
|
|
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
|
|
|
use Icinga\Exception\ProgrammingError;
|
|
|
|
|
|
|
|
class CustomVariableNull extends CustomVariable
|
|
|
|
{
|
|
|
|
public function equals(CustomVariable $var)
|
|
|
|
{
|
2016-02-22 11:13:16 +01:00
|
|
|
return $var instanceof CustomVariableNull;
|
2015-08-28 18:13:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getValue()
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2016-02-23 10:15:39 +01:00
|
|
|
public function getDbValue()
|
|
|
|
{
|
|
|
|
return json_encode($this->getValue());
|
|
|
|
}
|
|
|
|
|
2015-10-28 22:24:34 +01:00
|
|
|
public function getDbFormat()
|
|
|
|
{
|
|
|
|
return 'json';
|
|
|
|
}
|
|
|
|
|
2015-08-28 18:13:01 +02:00
|
|
|
public function setValue($value)
|
|
|
|
{
|
|
|
|
if (! is_null($value)) {
|
|
|
|
throw new ProgrammingError(
|
|
|
|
'Null can only be null, got %s',
|
|
|
|
var_export($value, 1)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
2016-02-26 11:58:37 +01:00
|
|
|
}
|
2015-08-28 18:13:01 +02:00
|
|
|
|
|
|
|
public function toConfigString()
|
|
|
|
{
|
|
|
|
return 'null';
|
|
|
|
}
|
|
|
|
}
|