Documentation

Manager
in package
implements ArrayAccess, Countable, IteratorAggregate

Event manager class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
4.2.0

Table of Contents

Interfaces

ArrayAccess
Countable
IteratorAggregate

Constants

KILL  = 'Pop\\Event\\Manager::KILL'
Constant to send a kill signal to the application
STOP  = 'Pop\\Event\\Manager::STOP'
Constant to stop the event manager

Properties

$alive  : bool
Event 'alive' tracking flag
$listeners  : array<string|int, mixed>
Event listeners
$results  : array<string|int, mixed>
Event results

Methods

__construct()  : mixed
Constructor
__get()  : mixed
Get an event
__isset()  : bool
Determine if an event exists
__set()  : void
Set an event
__unset()  : void
Unset an event
alive()  : bool
Determine if the project application is still alive or has been killed
count()  : int
Return count
get()  : mixed
Return an event
getIterator()  : ArrayIterator
Get iterator
getResults()  : mixed
Return the event results
has()  : bool
Determine whether the event manage has an event registered with it
off()  : Manager
Detach an event listener
offsetExists()  : bool
Determine if an event exists
offsetGet()  : mixed
Get an event
offsetSet()  : void
Set an event
offsetUnset()  : void
Unset an event
on()  : Manager
Attach an event listener
trigger()  : void
Trigger an event listener priority

Constants

KILL

Constant to send a kill signal to the application

public string KILL = 'Pop\\Event\\Manager::KILL'

STOP

Constant to stop the event manager

public string STOP = 'Pop\\Event\\Manager::STOP'

Properties

$alive

Event 'alive' tracking flag

protected bool $alive = true

$listeners

Event listeners

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

$results

Event results

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

Methods

__construct()

Constructor

public __construct([string|null $name = null ][, mixed $action = null ][, int $priority = 0 ]) : mixed

Instantiate the event manager object.

Parameters
$name : string|null = null
$action : mixed = null
$priority : int = 0

__get()

Get an event

public __get(string $name) : mixed
Parameters
$name : string

__isset()

Determine if an event exists

public __isset(string $name) : bool
Parameters
$name : string
Return values
bool

__set()

Set an event

public __set(string $name, mixed $value) : void
Parameters
$name : string
$value : mixed

__unset()

Unset an event

public __unset(string $name) : void
Parameters
$name : string

alive()

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

public alive() : bool
Return values
bool

count()

Return count

public count() : int
Return values
int

get()

Return an event

public get(string $name) : mixed
Parameters
$name : string

getIterator()

Get iterator

public getIterator() : ArrayIterator
Return values
ArrayIterator

getResults()

Return the event results

public getResults(string $name) : mixed
Parameters
$name : string

has()

Determine whether the event manage has an event registered with it

public has(string $name) : bool
Parameters
$name : string
Return values
bool

off()

Detach an event listener

public off(string $name, mixed $action) : Manager
Parameters
$name : string
$action : mixed
Return values
Manager

offsetExists()

Determine if an event exists

public offsetExists(string $offset) : bool
Parameters
$offset : string
Return values
bool

offsetGet()

Get an event

public offsetGet(mixed $offset) : mixed
Parameters
$offset : mixed

offsetSet()

Set an event

public offsetSet(mixed $offset, mixed $value) : void
Parameters
$offset : mixed
$value : mixed

offsetUnset()

Unset an event

public offsetUnset(mixed $offset) : void
Parameters
$offset : mixed

on()

Attach an event listener

public on(string $name, mixed $action[, int $priority = 0 ]) : Manager

$event->on('event.name', 'someFunction'); $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
$name : string
$action : mixed
$priority : int = 0
Return values
Manager

trigger()

Trigger an event listener priority

public trigger(string $name[, array<string|int, mixed> $params = [] ]) : void
Parameters
$name : string
$params : array<string|int, mixed> = []

        
On this page

Search results