\PhugInvoker

Summary

Methods
Properties
Constants
__construct()
reset()
all()
add()
addCallback()
remove()
removeByType()
getQueuesByEvent()
getCallbacksByEvent()
invoke()
getCallbackType()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$invokables
N/A

Properties

$invokables

$invokables : array<mixed,\Phug\Event\ListenerQueue>

List of callbacks grouped by type.

Type

array<mixed,\Phug\Event\ListenerQueue>

Methods

__construct()

__construct(array<mixed,callable>  $invokables = array()) 

Event constructor.

Parameters

array<mixed,callable> $invokables

list of callbacks to start with

Throws

\ReflectionException

reset()

reset() 

Remove all callbacks from the list.

all()

all() : array<mixed,\Phug\Event\ListenerQueue>

Get all callbacks from the list.

Returns

array<mixed,\Phug\Event\ListenerQueue>

add()

add(array<mixed,callable>  $invokables) 

Add a list of callbacks.

Parameters

array<mixed,callable> $invokables

list of callbacks

Throws

\ReflectionException
\RuntimeException

addCallback()

addCallback(callable  $invokable,   $name = null) 

Add a single callback.

Parameters

callable $invokable

typed callback

$name

Throws

\ReflectionException
\RuntimeException

remove()

remove(array<mixed,callable>  $invokables) 

Remove callbacks from the list.

Parameters

array<mixed,callable> $invokables

list of callbacks

removeByType()

removeByType(string  $type) 

Remove callbacks from the list by a given class/interface name.

Parameters

string $type

exact type of a callback argument.

getQueuesByEvent()

getQueuesByEvent(object  $event) : \Phug\iterable|array<mixed,\Phug\Event\ListenerQueue>

Return listeners queues for types that match the given event.

Parameters

object $event

instance of callback input.

Returns

\Phug\iterable|array<mixed,\Phug\Event\ListenerQueue>

getCallbacksByEvent()

getCallbacksByEvent(object  $event) : \Phug\iterable|array<mixed,callable>

Return callbacks for types that match the given event.

Parameters

object $event

instance of callback input.

Returns

\Phug\iterable|array<mixed,callable>

invoke()

invoke(object  $event) : array

Invoke callbacks that match the passed event.

Parameters

object $event

instance of callback input.

Returns

array

getCallbackType()

getCallbackType(callable  $invokable) : string|null

Return the typehint as string of the first argument of a given callback or null if not typed.

Parameters

callable $invokable

closure or callable

Throws

\ReflectionException

Returns

string|null