Documentation

Hooks implements HookManager

Handles adding and dispatching events

Table of Contents

Interfaces

HookManager
Event dispatcher

Properties

$hooks  : array<string|int, mixed>
Registered callbacks for each hook

Methods

dispatch()  : bool
Dispatch a message
register()  : mixed
Register a callback for a hook

Properties

$hooks

Registered callbacks for each hook

protected array<string|int, mixed> $hooks = []

Methods

dispatch()

Dispatch a message

public dispatch(string $hook[, array<string|int, mixed> $parameters = [] ]) : bool
Parameters
$hook : string

Hook name

$parameters : array<string|int, mixed> = []

Parameters to pass to callbacks

Tags
throws
InvalidArgument

When the passed $hook argument is not a string.

throws
InvalidArgument

When the passed $parameters argument is not an array.

Return values
bool

Successfulness

register()

Register a callback for a hook

public register(string $hook, callable $callback[, int $priority = 0 ]) : mixed
Parameters
$hook : string

Hook name

$callback : callable

Function/method to call on event

$priority : int = 0

Priority number. <0 is executed earlier, >0 is executed later

Tags
throws
InvalidArgument

When the passed $hook argument is not a string.

throws
InvalidArgument

When the passed $callback argument is not callable.

throws
InvalidArgument

When the passed $priority argument is not an integer.


        
On this page

Search results