diff --git a/library/Director/Hook/PropertyModifierHook.php b/library/Director/Hook/PropertyModifierHook.php index 1aa14615..aa846911 100644 --- a/library/Director/Hook/PropertyModifierHook.php +++ b/library/Director/Hook/PropertyModifierHook.php @@ -7,15 +7,19 @@ use Icinga\Module\Director\Db; abstract class PropertyModifierHook { - protected $settings = array(); + /** @var array */ + protected $settings = []; + /** @var string */ private $targetProperty; + /** @var Db */ private $db; - /** - * @var \stdClass - */ + /** @var bool */ + private $rejected = false; + + /** @var \stdClass */ private $row; /** @@ -23,7 +27,7 @@ abstract class PropertyModifierHook * * Your custom property modifier needs to implement this method. * - * @return value + * @return mixed $value */ abstract public function transform($value); @@ -55,6 +59,21 @@ abstract class PropertyModifierHook return false; } + /** + * Reject this whole row + * + * Allows your property modifier to reject specific rows + * + * @param bool $reject + * @return $this + */ + public function rejectRow($reject = true) + { + $this->rejected = (bool) $reject; + + return $this; + } + /** * Whether this PropertyModifier wants access to the current row * @@ -67,6 +86,16 @@ abstract class PropertyModifierHook return false; } + /** + * Whether this modifier wants to reject the current row + * + * @return bool + */ + public function rejectsRow() + { + return $this->rejected; + } + /** * Get the current row *