blob: 9953fae72426ec6c48434919f509a801849e57c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<?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 getDbValue()
{
return json_encode($this->getValue());
}
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;
$this->deleted = false;
return $this;
}
public function toConfigString($renderExpressions = false)
{
return $this->value ? 'true' : 'false';
}
public function toLegacyConfigString()
{
return $this->toConfigString();
}
}
|