2015-10-28 22:27:01 +01:00

43 lines
796 B
PHP

<?php
namespace Icinga\Module\Director\CustomVariable;
use Icinga\Exception\ProgrammingError;
class CustomVariableBoolean extends CustomVariable
{
public function equals(CustomVariable $var)
{
return $var->getValue() === $this->getValue();
}
public function getDbFormat()
{
return 'json';
}
public function getValue()
{
return $this->value;
}
public function setValue($value)
{
if (! is_bool($value)) {
throw new ProgrammingError(
'Expected a boolean, got %s',
var_export($value, 1)
);
}
$this->value = $value;
return $this;
}
public function toConfigString()
{
return $this->value ? 'true' : 'false';
}
}