Documentation

Manager extends AbstractManager
in package

Event manager class

Tags
category

Pop

author

Nick Sagona, III dev@noladev.com

copyright

Copyright (c) 2009-2026 NOLA Interactive, LLC.

license

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

version
4.4.0

Table of Contents

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
$items  : array<string|int, mixed>
Manager items
$results  : array<string|int, mixed>
Event results

Methods

__construct()  : mixed
Constructor
__get()  : mixed
Get an item
__isset()  : bool
Determine if an item exists
__set()  : void
Set an event
__unset()  : void
Unset an item
addItem()  : static
Add an item
addItems()  : static
Add items
alive()  : bool
Determine if the project application is still alive or has been killed
count()  : int
Return count
get()  : mixed
Return an event
getItem()  : mixed
Get an item
getItems()  : array<string|int, mixed>
Get items
getIterator()  : ArrayIterator
Get iterator
getResults()  : mixed
Return the event results
has()  : bool
Determine whether the event manager has an event registered with it
hasItem()  : bool
Determine whether the manager has an item
hasItems()  : bool
Determine whether the manager has items
off()  : Manager
Detach an event listener
offsetExists()  : bool
Determine if an item exists
offsetGet()  : mixed
Get an item
offsetSet()  : void
Set an event
offsetUnset()  : void
Unset an item
on()  : Manager
Attach an event listener
removeItem()  : static
Remove an item
setItems()  : static
Set items
trigger()  : void
Trigger an event listener

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

$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 item

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

__isset()

Determine if an item 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 item

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

addItem()

Add an item

public addItem(mixed $item[, mixed $name = null ]) : static
Parameters
$item : mixed
$name : mixed = null
Return values
static

addItems()

Add items

public addItems(array<string|int, mixed> $items) : static
Parameters
$items : array<string|int, mixed>
Return values
static

alive()

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

public alive() : bool
Return values
bool

get()

Return an event

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

getItem()

Get an item

public getItem(mixed $name) : mixed
Parameters
$name : mixed

getItems()

Get items

public getItems() : array<string|int, mixed>
Return values
array<string|int, mixed>

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 manager has an event registered with it

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

hasItem()

Determine whether the manager has an item

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

hasItems()

Determine whether the manager has items

public hasItems() : bool
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 item exists

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

offsetGet()

Get an item

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 item

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

removeItem()

Remove an item

public removeItem(mixed $name) : static
Parameters
$name : mixed
Return values
static

setItems()

Set items

public setItems(array<string|int, mixed> $items) : static
Parameters
$items : array<string|int, mixed>
Return values
static

trigger()

Trigger an event listener

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

        
On this page

Search results