\Cake\Event\DecoratorConditionDecorator

Event Condition Decorator

Use this decorator to allow your event listener to only be invoked if the if and/or unless conditions pass.

Summary

Methods
Properties
Constants
__construct()
__invoke()
canTrigger()
No public properties found
No constants found
_call()
_evaluateCondition()
$_callable
$_options
N/A
No private methods found
No private properties found
N/A

Properties

$_callable

$_callable : callable

Callable

Type

callable

$_options

$_options : array

Decorator options

Type

array

Methods

__construct()

__construct(callable  $callable, array  $options = array()) 

Constructor.

Parameters

callable $callable

Callable.

array $options

Decorator options.

__invoke()

__invoke() : mixed

Invoke

Returns

mixed

canTrigger()

canTrigger(\Cake\Event\Event  $event) : boolean

Checks if the event is triggered for this listener.

Parameters

\Cake\Event\Event $event

Event object.

Returns

boolean

_call()

_call(array  $args) : mixed

Calls the decorated callable with the passed arguments.

Parameters

array $args

Arguments for the callable.

Returns

mixed

_evaluateCondition()

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

Evaluates the filter conditions

Parameters

string $condition

Condition type

\Cake\Event\Event $event

Event object

Returns

boolean