Director/PropertyModifier: Create first basic property modifiers refs: #9707
This commit is contained in:
parent
103623211b
commit
06fc7d82a0
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\Sync;
|
||||
namespace Icinga\Module\Director\PropertyModifier;
|
||||
|
||||
use Icinga\Module\Director\Web\Hook\PropertyModifierHook;
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\PropertyModifier;
|
||||
|
||||
use Icinga\Module\Director\Web\Hook\PropertyModifierHook;
|
||||
|
||||
class PropertyModifierRegexReplace extends PropertyModifierHook
|
||||
{
|
||||
|
||||
public function transform($value)
|
||||
{
|
||||
return preg_replace($this->settings['pattern'], $this->settings['replacement'], $value);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\PropertyModifier;
|
||||
|
||||
use Icinga\Module\Director\Web\Hook\PropertyModifierHook;
|
||||
|
||||
class PropertyModifierReplace PropertyModifierHook
|
||||
{
|
||||
|
||||
public function transform($value)
|
||||
{
|
||||
return str_replace($this->settings['string'], $this->settings['replacement'], $value);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\PropertyModifier;
|
||||
|
||||
use Icinga\Module\Director\Web\Hook\PropertyModifierHook;
|
||||
|
||||
class PropertyModifierStripDomain extends PropertyModifierHook
|
||||
{
|
||||
|
||||
public function transform($value)
|
||||
{
|
||||
return preg_replace($this->settings['domain'], "", $value);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\PropertyModifier;
|
||||
|
||||
use Icinga\Module\Director\Web\Hook\PropertyModifierHook;
|
||||
|
||||
class PropertyModifierSubstring extends PropertyModifierHook
|
||||
{
|
||||
|
||||
public function transform($value)
|
||||
{
|
||||
return substr($value, $this->settings['start'], $this->settings['end'] - $this->settings['start']);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\PropertyModifier;
|
||||
|
||||
use Icinga\Module\Director\Web\Hook\PropertyModifierHook;
|
||||
|
||||
class PropertyModifierUppercase extends PropertyModifierHook
|
||||
{
|
||||
|
||||
public function transform($value)
|
||||
{
|
||||
return strtoupper($value);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue