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
    
    
    
      
  
      Property Summary
- 
        $_callable protectedcallableCallable 
- 
        $_options protectedarrayDecorator options 
Method Summary
- 
          __construct() publicConstructor. 
- 
          __invoke() public
- 
          _call() protectedCalls the decorated callable with the passed arguments. 
- 
          _evaluateCondition() protectedEvaluates the filter conditions 
- 
          canTrigger() publicChecks if the event is triggered for this listener. 
Method Detail
__construct() ¶ public
__construct(callable $callable, array<string, mixed> $options = [])Constructor.
Parameters
- 
                callable$callable
- Callable. 
- 
                array<string, mixed>$options optional
- Decorator options. 
_call() ¶ protected
_call(array $args): mixedCalls the decorated callable with the passed arguments.
Parameters
- 
                array$args
- Arguments for the callable. 
Returns
mixed_evaluateCondition() ¶ protected
_evaluateCondition(string $condition, Cake\Event\EventInterface<TSubject> $event): boolEvaluates the filter conditions
Templates
              TSubject
               of object                            Parameters
- 
                string$condition
- Condition type 
- 
                Cake\Event\EventInterface<TSubject>$event
- Event object 
Returns
boolcanTrigger() ¶ public
canTrigger(Cake\Event\EventInterface<TSubject> $event): boolChecks if the event is triggered for this listener.
Templates
              TSubject
               of object                            Parameters
- 
                Cake\Event\EventInterface<TSubject>$event
- Event object. 
Returns
bool