Manager
extends AbstractManager
in package
Event manager class
Tags
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
$items
Manager items
protected
array<string|int, mixed>
$items
= []
$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
staticaddItems()
Add items
public
addItems(array<string|int, mixed> $items) : static
Parameters
- $items : array<string|int, mixed>
Return values
staticalive()
Determine if the project application is still alive or has been killed
public
alive() : bool
Return values
boolcount()
Return count
public
count() : int
Return values
intget()
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
ArrayIteratorgetResults()
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
boolhasItem()
Determine whether the manager has an item
public
hasItem(string $name) : bool
Parameters
- $name : string
Return values
boolhasItems()
Determine whether the manager has items
public
hasItems() : bool
Return values
booloff()
Detach an event listener
public
off(string $name, mixed $action) : Manager
Parameters
- $name : string
- $action : mixed
Return values
ManageroffsetExists()
Determine if an item exists
public
offsetExists(string $offset) : bool
Parameters
- $offset : string
Return values
booloffsetGet()
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
ManagerremoveItem()
Remove an item
public
removeItem(mixed $name) : static
Parameters
- $name : mixed
Return values
staticsetItems()
Set items
public
setItems(array<string|int, mixed> $items) : static
Parameters
- $items : array<string|int, mixed>
Return values
statictrigger()
Trigger an event listener
public
trigger(string $name[, array<string|int, mixed> $params = [] ]) : void
Parameters
- $name : string
- $params : array<string|int, mixed> = []