Documentation

Listener
in package

Class \Hoa\Event\Listener.

A contrario of events, listeners are synchronous, identified at use and useful for close interactions between one or some components.

Tags
copyright

Copyright © 2007-2017 Hoa community

license

New BSD License

Table of Contents

Properties

$_callables  : array<string|int, mixed>
All listener IDs and associated listeners.
$_source  : Listenable
Source of listener (for Bucket).

Methods

__construct()  : mixed
Build a listener.
addIds()  : void
Add acceptable ID (or reset).
attach()  : Listener
Attach a callable to a listenable component.
detach()  : Listener
Detach a callable from a listenable component.
detachAll()  : Listener
Detach all callables from a listenable component.
fire()  : array<string|int, mixed>
Send/fire a bucket to a listener.
listenerExists()  : bool
Check if a listener exists.

Properties

$_callables

All listener IDs and associated listeners.

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

Methods

__construct()

Build a listener.

public __construct(Listenable $source, array<string|int, mixed> $ids) : mixed
Parameters
$source : Listenable

Source (for Bucket).

$ids : array<string|int, mixed>

Accepted ID.

addIds()

Add acceptable ID (or reset).

public addIds(array<string|int, mixed> $ids) : void
Parameters
$ids : array<string|int, mixed>

Accepted ID.

attach()

Attach a callable to a listenable component.

public attach(string $listenerId, mixed $callable) : Listener
Parameters
$listenerId : string

Listener ID.

$callable : mixed

Callable.

Tags
throws
Exception
Return values
Listener

detach()

Detach a callable from a listenable component.

public detach(string $listenerId, mixed $callable) : Listener
Parameters
$listenerId : string

Listener ID.

$callable : mixed

Callable.

Return values
Listener

detachAll()

Detach all callables from a listenable component.

public detachAll(string $listenerId) : Listener
Parameters
$listenerId : string

Listener ID.

Return values
Listener

fire()

Send/fire a bucket to a listener.

public fire(string $listenerId, Bucket $data) : array<string|int, mixed>
Parameters
$listenerId : string

Listener ID.

$data : Bucket

Data.

Tags
throws
Exception
Return values
array<string|int, mixed>

listenerExists()

Check if a listener exists.

public listenerExists(string $listenerId) : bool
Parameters
$listenerId : string

Listener ID.

Return values
bool

        
On this page

Search results