parent
b543531e32
commit
935f8d6b09
|
@ -30,7 +30,8 @@ next (will be 1.8.0)
|
||||||
* FEATURE: Property Modifier: get Host by Address (#2210)
|
* FEATURE: Property Modifier: get Host by Address (#2210)
|
||||||
* FEATURE: Property Modifier: skip duplicates (#2215)
|
* FEATURE: Property Modifier: skip duplicates (#2215)
|
||||||
* FEATURE: Property Modifier: trim strings (#1660)
|
* FEATURE: Property Modifier: trim strings (#1660)
|
||||||
* FEATURE: Import Sources now allow to download previewed data as JSON (#2096)
|
* FEATURE: Property Modifier: negate boolean (#2227)
|
||||||
|
* FEATURE: Import Sources now allows downloading previewed data as JSON (#2096)
|
||||||
* FEATURE: UTF8 validation for failed imports gives better error message (#2143)
|
* FEATURE: UTF8 validation for failed imports gives better error message (#2143)
|
||||||
* FEATURE: ArrayByElementPosition now allows filtering by key name (#1721)
|
* FEATURE: ArrayByElementPosition now allows filtering by key name (#1721)
|
||||||
* FIX: LDAP Import is now able to paginate limited results (#2019)
|
* FIX: LDAP Import is now able to paginate limited results (#2019)
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Icinga\Module\Director\PropertyModifier;
|
||||||
|
|
||||||
|
use Icinga\Module\Director\Hook\PropertyModifierHook;
|
||||||
|
use function ipl\Stdlib\get_php_type;
|
||||||
|
|
||||||
|
class PropertyModifierNegateBoolean extends PropertyModifierHook
|
||||||
|
{
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return 'Negate a boolean value';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function transform($value)
|
||||||
|
{
|
||||||
|
if ($value === null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (! is_bool($value)) {
|
||||||
|
throw new \InvalidArgumentException('Boolean expected, got ' . get_php_type($value));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ! $value;
|
||||||
|
}
|
||||||
|
}
|
|
@ -36,6 +36,7 @@ use Icinga\Module\Director\PropertyModifier\PropertyModifierListToObject;
|
||||||
use Icinga\Module\Director\PropertyModifier\PropertyModifierLowercase;
|
use Icinga\Module\Director\PropertyModifier\PropertyModifierLowercase;
|
||||||
use Icinga\Module\Director\PropertyModifier\PropertyModifierMakeBoolean;
|
use Icinga\Module\Director\PropertyModifier\PropertyModifierMakeBoolean;
|
||||||
use Icinga\Module\Director\PropertyModifier\PropertyModifierMap;
|
use Icinga\Module\Director\PropertyModifier\PropertyModifierMap;
|
||||||
|
use Icinga\Module\Director\PropertyModifier\PropertyModifierNegateBoolean;
|
||||||
use Icinga\Module\Director\PropertyModifier\PropertyModifierParseURL;
|
use Icinga\Module\Director\PropertyModifier\PropertyModifierParseURL;
|
||||||
use Icinga\Module\Director\PropertyModifier\PropertyModifierRegexReplace;
|
use Icinga\Module\Director\PropertyModifier\PropertyModifierRegexReplace;
|
||||||
use Icinga\Module\Director\PropertyModifier\PropertyModifierRegexSplit;
|
use Icinga\Module\Director\PropertyModifier\PropertyModifierRegexSplit;
|
||||||
|
@ -102,6 +103,7 @@ $directorHooks = [
|
||||||
PropertyModifierLowercase::class,
|
PropertyModifierLowercase::class,
|
||||||
PropertyModifierMakeBoolean::class,
|
PropertyModifierMakeBoolean::class,
|
||||||
PropertyModifierMap::class,
|
PropertyModifierMap::class,
|
||||||
|
PropertyModifierNegateBoolean::class,
|
||||||
PropertyModifierParseURL::class,
|
PropertyModifierParseURL::class,
|
||||||
PropertyModifierRegexReplace::class,
|
PropertyModifierRegexReplace::class,
|
||||||
PropertyModifierRegexSplit::class,
|
PropertyModifierRegexSplit::class,
|
||||||
|
|
Loading…
Reference in New Issue