Filter
- Full name:
\Qubus\EventDispatcher\ActionFilter\Filter
- Parent class:
\Qubus\EventDispatcher\ActionFilter\BaseHooks
- This class is marked as final and can't be subclassed
- This class implements:
\Qubus\EventDispatcher\ActionFilter\Filterable
,\Qubus\EventDispatcher\ActionFilter\RemoveAllFilters
- This class is a Final class
Properties
value
Holds the value of the filter.
Methods
addFilter
Adds a filter.
public addFilter(string $hook, mixed $callback, int $priority = self::PRIORITY_NEUTRAL, int $arguments = self::ARGUMENT_NEUTRAL): \Qubus\EventDispatcher\ActionFilter\BaseHooks
Parameters:
Parameter | Type | Description |
---|---|---|
$hook | string | Hook name. |
$callback | mixed | Function to execute. |
$priority | int | Priority of the filter. |
$arguments | int | Number of arguments to accept. |
applyFilter
Runs a filter.
Parameters:
Parameter | Type | Description |
---|---|---|
$args | mixed | First argument will be the name of the hook, and the rest will be args for the hook. |
Throws:
removeFilter
Removes a filter.
Parameters:
Parameter | Type | Description |
---|---|---|
$hook | string | Hook name. |
$callback | mixed | Function to execute. |
$priority | int | Priority of the filter. |
removeAllFilters
Removes all filters.
Parameters:
Parameter | Type | Description |
---|---|---|
$hook | string|null | Hook name. |
trigger
Filters a value.
When a filter is triggered, all hooks are run in the order supplied when adding them.
Parameters:
Parameter | Type | Description |
---|---|---|
$filter | string | Name of filter. |
$args | mixed | Arguments passed to the filter. |
Return Value:
Returns value or false on error.
Throws:
Inherited methods
listen
Adds a hook.
public listen(string $hook, mixed $callback, int $priority = self::PRIORITY_NEUTRAL, int $arguments = self::ARGUMENT_NEUTRAL): \Qubus\EventDispatcher\ActionFilter\BaseHooks
Parameters:
Parameter | Type | Description |
---|---|---|
$hook | string | Hook name. |
$callback | mixed | Function to execute. |
$priority | int | Priority of the action. |
$arguments | int | Number of arguments to accept. |
remove
Removes a hook.
Parameters:
Parameter | Type | Description |
---|---|---|
$hook | string | Hook name. |
$callback | mixed | Function to execute. |
$priority | int | Priority of the action. |
removeAll
Remove all hooks with given hook in collection. If no hook, clear all hooks.
Parameters:
Parameter | Type | Description |
---|---|---|
$hook | string|null | Hook name. |
getHooks
Gets a sorted list of all hooks.
getFunction
Gets the function.
Parameters:
Parameter | Type | Description |
---|---|---|
$callback | mixed | Callback. |
Return Value:
A closure
Throws:
createHook
Figures out the hook.
Will return an object with two keys. One for the name and one for the arguments that will be passed to the hook itself.
Parameters:
Parameter | Type | Description |
---|---|---|
$args | mixed |
trigger
Fires a new action/filter.
- This method is abstract.
Parameters:
Parameter | Type | Description |
---|---|---|
$action | string | Name of action |
$args | mixed | Arguments passed to the action |
Automatically generated on 2025-10-13