2015-08-28 12:13:01 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\CustomVariable;
|
|
|
|
|
|
|
|
|
|
use Icinga\Exception\ProgrammingError;
|
|
|
|
|
|
|
|
|
|
class CustomVariableNull extends CustomVariable
|
|
|
|
|
{
|
|
|
|
|
public function equals(CustomVariable $var)
|
|
|
|
|
{
|
2016-02-22 05:13:16 -05:00
|
|
|
return $var instanceof CustomVariableNull;
|
2015-08-28 12:13:01 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getValue()
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-23 04:15:39 -05:00
|
|
|
public function getDbValue()
|
|
|
|
|
{
|
|
|
|
|
return json_encode($this->getValue());
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-28 17:24:34 -04:00
|
|
|
public function getDbFormat()
|
|
|
|
|
{
|
|
|
|
|
return 'json';
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-28 12:13:01 -04:00
|
|
|
public function setValue($value)
|
|
|
|
|
{
|
|
|
|
|
if (! is_null($value)) {
|
|
|
|
|
throw new ProgrammingError(
|
|
|
|
|
'Null can only be null, got %s',
|
2024-01-17 08:59:56 -05:00
|
|
|
var_export($value, true)
|
2015-08-28 12:13:01 -04:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-08 18:40:07 -04:00
|
|
|
$this->deleted = false;
|
|
|
|
|
|
2015-08-28 12:13:01 -04:00
|
|
|
return $this;
|
2016-02-26 05:58:37 -05:00
|
|
|
}
|
2015-08-28 12:13:01 -04:00
|
|
|
|
2016-11-12 09:03:11 -05:00
|
|
|
public function toConfigString($renderExpressions = false)
|
2015-08-28 12:13:01 -04:00
|
|
|
{
|
|
|
|
|
return 'null';
|
|
|
|
|
}
|
2016-10-14 05:53:04 -04:00
|
|
|
|
|
|
|
|
public function toLegacyConfigString()
|
|
|
|
|
{
|
|
|
|
|
return $this->toConfigString();
|
|
|
|
|
}
|
2015-08-28 12:13:01 -04:00
|
|
|
}
|