Requests 2.0.0 API

Hooks implements HookManager

Handles adding and dispatching events

Interfaces, Classes and Traits

HookManager
Event dispatcher

Table of Contents

$hooks  : array<string|int, mixed>
Registered callbacks for each hook
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) : mixed
Parameters
$hook : string

Hook name

$callback : callable

Function/method to call on event

$priority : int

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.

Return values
mixed

Search results