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.

Cake\Event\Decorator\AbstractDecorator
Extended by Cake\Event\Decorator\ConditionDecorator

Inherited Properties

Method Summary

Method Detail

__invoke()source public

__invoke( )

Invoke

Returns

mixed

Overrides

Cake\Event\Decorator\AbstractDecorator::__invoke()

_evaluateCondition()source protected

_evaluateCondition( string $condition , Cake\Event\Event $event )

Evaluates the filter conditions

Parameters

string $condition
Condition type
Cake\Event\Event $event
Event object

Returns

boolean

canTrigger()source public

canTrigger( Cake\Event\Event $event )

Checks if the event is triggered for this listener.

Parameters

Cake\Event\Event $event
Event object.

Returns

boolean

Methods inherited from Cake\Event\Decorator\AbstractDecorator

__construct()source public

__construct( callable $callable , array $options [] )

Constructor.

Parameters

callable $callable
Callable.
array $options optional []
Decorator options.

_call()source protected

_call( array $args )

Calls the decorated callable with the passed arguments.

Parameters

array $args
Arguments for the callable.

Returns

mixed

© 2005–2017 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.4/class-Cake.Event.Decorator.ConditionDecorator.html