diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:17:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:17:31 +0000 |
commit | f66ab8dae2f3d0418759f81a3a64dc9517a62449 (patch) | |
tree | fbff2135e7013f196b891bbde54618eb050e4aaf /library/Director/CustomVariable/CustomVariableNull.php | |
parent | Initial commit. (diff) | |
download | icingaweb2-module-director-f66ab8dae2f3d0418759f81a3a64dc9517a62449.tar.xz icingaweb2-module-director-f66ab8dae2f3d0418759f81a3a64dc9517a62449.zip |
Adding upstream version 1.10.2.upstream/1.10.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | library/Director/CustomVariable/CustomVariableNull.php | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/library/Director/CustomVariable/CustomVariableNull.php b/library/Director/CustomVariable/CustomVariableNull.php new file mode 100644 index 0000000..f87ccfa --- /dev/null +++ b/library/Director/CustomVariable/CustomVariableNull.php @@ -0,0 +1,52 @@ +<?php + +namespace Icinga\Module\Director\CustomVariable; + +use Icinga\Exception\ProgrammingError; + +class CustomVariableNull extends CustomVariable +{ + public function equals(CustomVariable $var) + { + return $var instanceof CustomVariableNull; + } + + public function getValue() + { + return null; + } + + public function getDbValue() + { + return json_encode($this->getValue()); + } + + public function getDbFormat() + { + return 'json'; + } + + public function setValue($value) + { + if (! is_null($value)) { + throw new ProgrammingError( + 'Null can only be null, got %s', + var_export($value, 1) + ); + } + + $this->deleted = false; + + return $this; + } + + public function toConfigString($renderExpressions = false) + { + return 'null'; + } + + public function toLegacyConfigString() + { + return $this->toConfigString(); + } +} |