Class ConditionDecorator
Event Condition Decorator
Use this decorator to allow your event listener to only be invoked if the if and/or unless conditions pass.
Namespace: Cake\Event\Decorator
Properties summary
- $_callable protected
callableCallable
- $_options protected
arrayDecorator options
Method Summary
Method Detail
__construct() public
__construct(callable $callable, array $options)
Constructor.
Parameters
-
callable$callable Callable.
-
array$options optional Decorator options.
__invoke() public
__invoke()
_call() protected
_call(mixed $args)
Calls the decorated callable with the passed arguments.
Parameters
-
array$args Arguments for the callable.
Returns
mixed_evaluateCondition() protected
_evaluateCondition(mixed $condition, \Cake\Event\Event $event)
Evaluates the filter conditions
Parameters
-
string$condition Condition type
-
\Cake\Event\Event$event Event object
Returns
boolcanTrigger() public
canTrigger(\Cake\Event\Event $event)
Checks if the event is triggered for this listener.
Parameters
-
\Cake\Event\Event$event Event object.
Returns
boolProperty Detail
$_callable protected
Callable
Type
callable$_options protected
Decorator options
Type
array
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.9/class-Cake.Event.Decorator.ConditionDecorator.html