\Pop\EventManager

Event manager class

Summary

Methods
Properties
Constants
__construct()
on()
off()
get()
has()
getResults()
alive()
trigger()
__set()
__get()
__isset()
__unset()
offsetSet()
offsetGet()
offsetExists()
offsetUnset()
count()
getIterator()
No public properties found
STOP
KILL
No protected methods found
$listeners
$results
$alive
N/A
No private methods found
No private properties found
N/A

Constants

STOP

STOP

Constant to stop the event manager

KILL

KILL

Constant to send a kill signal to the application

Properties

$listeners

$listeners : array

Event listeners

Type

array

$results

$results : array

Event results

Type

array

$alive

$alive : boolean

Event 'alive' tracking flag

Type

boolean

Methods

__construct()

__construct(string  $name = null, mixed  $action = null, integer  $priority) 

Constructor

Instantiate the event manager object.

Parameters

string $name
mixed $action
integer $priority

on()

on(string  $name, mixed  $action, integer  $priority) : \Pop\Event\Manager

Attach an event listener

$event->on('event.name', function() { ... }); $event->on('event.name', new SomeClass()); $event->on('event.name', [new SomeClass, 'foo']); $event->on('event.name', 'SomeClass'); $event->on('event.name', 'SomeClass->foo'); $event->on('event.name', 'SomeClass::bar');

Parameters

string $name
mixed $action
integer $priority

Returns

\Pop\Event\Manager

off()

off(string  $name, mixed  $action) : \Pop\Event\Manager

Detach an event listener

Parameters

string $name
mixed $action

Returns

\Pop\Event\Manager

get()

get(string  $name) : mixed

Return an event

Parameters

string $name

Returns

mixed

has()

has(string  $name) : boolean

Determine whether the event manage has an event registered with it

Parameters

string $name

Returns

boolean

getResults()

getResults(string  $name) : mixed

Return the event results

Parameters

string $name

Returns

mixed

alive()

alive() : boolean

Determine if the project application is still alive or has been killed

Returns

boolean

trigger()

trigger(string  $name, array  $args = array()) : void

Trigger an event listener priority

Parameters

string $name
array $args

Throws

\Pop\Event\Exception

__set()

__set(string  $name, mixed  $value) : \Pop\Event\Manager

Set an event

Parameters

string $name
mixed $value

Returns

\Pop\Event\Manager

__get()

__get(string  $name) : mixed

Get an event

Parameters

string $name

Returns

mixed

__isset()

__isset(string  $name) : boolean

Determine if an event exists

Parameters

string $name

Returns

boolean

__unset()

__unset(string  $name) : \Pop\Event\Manager

Unset an event

Parameters

string $name

Returns

\Pop\Event\Manager

offsetSet()

offsetSet(string  $offset, mixed  $value) : \Pop\Event\Manager

Set an event

Parameters

string $offset
mixed $value

Returns

\Pop\Event\Manager

offsetGet()

offsetGet(string  $offset) : mixed

Get an event

Parameters

string $offset

Returns

mixed

offsetExists()

offsetExists(string  $offset) : boolean

Determine if an event exists

Parameters

string $offset

Returns

boolean

offsetUnset()

offsetUnset(string  $offset) : \Pop\Event\Manager

Unset an event

Parameters

string $offset

Returns

\Pop\Event\Manager

count()

count() : integer

Return count

Returns

integer

getIterator()

getIterator() : \ArrayIterator

Get iterator

Returns

\ArrayIterator