mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2026-05-28 04:35:53 -04:00
PropertyModifierSubstring: allow to skip length
This commit is contained in:
parent
ffb0177a16
commit
480573cba0
1 changed files with 13 additions and 1 deletions
|
|
@ -33,6 +33,18 @@ class PropertyModifierSubstring extends PropertyModifierHook
|
|||
|
||||
public function transform($value)
|
||||
{
|
||||
return substr($value, $this->getSetting('start'), $this->getSetting('length'));
|
||||
$length = $this->getSetting('length');
|
||||
if (is_numeric($length)) {
|
||||
return substr(
|
||||
$value,
|
||||
(int) $this->getSetting('start'),
|
||||
(int) $length
|
||||
);
|
||||
} else {
|
||||
return substr(
|
||||
$value,
|
||||
(int) $this->getSetting('start')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue