Event Class

package Fuel
category Core
author Eric Barnes
author Harro "WanWizard" Verton

 Methods

Constructor, sets all initial events.

__construct(array $events) 

Parameters

$events

array

events array

Has Listeners

has_events(string $event) : bool

Checks if the event has listeners

Parameters

$event

string

The name of the event

Returns

boolWhether the event has listeners

Register

register() : void

Registers a Callback for a given event

Trigger

trigger(string $event, mixed $data, string $return_type, boolean $reversed) : mixed

Triggers an event and returns the results. The results can be returned in the following formats:

'array' 'json' 'serialized' 'string'

Parameters

$event

string

The name of the event

$data

mixed

Any data that is to be passed to the listener

$return_type

string

The return type

$reversed

boolean

Whether to fire events ordered LIFO instead of FIFO

Returns

mixedThe return of the listeners, in the return type

Unregister/remove one or all callbacks from event

unregister(string $event, mixed $callback) : boolean

Parameters

$event

string

event to remove from

$callback

mixed

callback to remove [optional, null for all]

Returns

booleanwhether one or all callbacks have been removed

Format Return

_format_return(array $calls, string $return_type) : mixed

Formats the return in the given type

Parameters

$calls

array

The array of returns

$return_type

string

The return type

Returns

mixedThe formatted return

 Properties

 

<p>An array of listeners</p>

$_events : array