PropertyModifierHook: add missing methods, cleanup

refs #1369
This commit is contained in:
Thomas Gelf 2018-01-25 13:14:33 +01:00
parent 53432c6d5c
commit 33f04d9e52

View File

@ -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
*