jEvent

Class which represents an event in the event system

package

jelix

subpackage

events

Methods

New event.

__construct(string $name, array $params = array()) 

Arguments

$name

string

the event name

$params

array

an associative array which contains parameters for the listeners

get a user param

__get(string $name) : mixed

Arguments

$name

string

the parameter name

Response

mixed

set a user param

__set(string $name, mixed $value) : mixed

Arguments

$name

string

the parameter name

$value

mixed

the value

Response

mixed

adds data in the responses list

add(mixed $response) 

Arguments

$response

mixed

a single response

for tests

clearCache() 
static
since 1.5

gets the name of the event will be used internally for optimisations

getName() 

gets the given param

getParam(string $name) : string|null
deprecated

since Jelix 1.6

Arguments

$name

string

the param name

Response

string|null

the value or null if the parameter does not exist

gets all the responses

getResponse() : array

Response

array

of associative array

look in all the responses if we have a parameter having value as its answer eg, we want to know if we have failed = true, we do

inResponse(string $responseName, mixed $value, array<mixed,mixed> &$response) : boolean

Arguments

$responseName

string

the param we're looking for

$value

mixed

the value we're looking for

$response

array<mixed,mixed>

the response that have this value

Response

boolean

whether or not we have founded the response value

construct the list of all listeners corresponding to an event

loadListenersFor(string $eventName) 
static

Arguments

$eventName

string

the event name we wants the listeners for.

send a notification to all modules

notify( $eventname,  $params = array()) : \jEvent
static

Arguments

$eventname

$params

Response

\jEvent

Properties

The name of the event.

_name : string
var

name

Type(s)

string

the event parameters

_params : 

Type(s)

of array

_responses : array
var

of array

Type(s)

array

compilerData

compilerData : 
static

Type(s)

because a listener can listen several events, we should create only one instancy of a listener for performance, and $hashListened will contains only reference to this listener.

listenersSingleton : array
static
var

of jEventListener

Type(s)

array

hash table for event listened.

hashListened : \associative
static

$_hash['eventName'] = array of events (by reference)

var

array of object

Type(s)

\associative