2015-06-11 08:15:51 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\CustomVariable;
|
|
|
|
|
2015-06-11 22:44:17 +02:00
|
|
|
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
2015-06-11 08:15:51 +02:00
|
|
|
|
|
|
|
class CustomVariableString extends CustomVariable
|
|
|
|
{
|
|
|
|
public function equals(CustomVariable $var)
|
|
|
|
{
|
2015-11-01 00:54:43 +01:00
|
|
|
if (! $var instanceof CustomVariableString) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-06-11 08:15:51 +02:00
|
|
|
return $var->getValue() === $this->getValue();
|
|
|
|
}
|
|
|
|
|
2015-06-11 21:33:47 +02:00
|
|
|
public function getValue()
|
|
|
|
{
|
|
|
|
return $this->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setValue($value)
|
|
|
|
{
|
|
|
|
if (! is_string($value)) {
|
|
|
|
$value = (string) $value;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($value !== $this->value) {
|
|
|
|
$this->value = $value;
|
|
|
|
$this->setModified();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2015-06-11 08:15:51 +02:00
|
|
|
public function toConfigString()
|
|
|
|
{
|
2015-06-11 21:33:47 +02:00
|
|
|
return c::renderString($this->getValue());
|
2015-06-11 08:15:51 +02:00
|
|
|
}
|
|
|
|
}
|