\app\framework\Component\EventManagerEventManager

EventManager is responsible for handling events. It is the main class for subscribing to events and firing events.<br /> Besides regular event names, it supports firing of wildcard events, ex: 'framy.*' will fire all events starting with 'framy.'

Summary

Methods
Properties
Constants
getInstance()
deleteInstance()
listen()
subscribe()
fire()
enable()
disable()
getEventListeners()
No public properties found
No constants found
serialize()
unserialize()
init()
$wfInstance
N/A
__construct()
__wakeup()
__clone()
fireWildcardEvents()
$suppressEvents
$eventProcessor
$events
N/A

Properties

$wfInstance

$wfInstance : 

Type

$suppressEvents

$suppressEvents : boolean

Suppress EventManager events

Type

boolean

Methods

getInstance()

getInstance() : $this

Return the current instance.

If instance doesn't exist, a new instance will be created.

Returns

$this

deleteInstance()

deleteInstance() 

Deletes the current singleton instance.

fire()

fire(string  $eventName, array|\app\framework\Component\EventManager\Event  $data = null, null  $resultType = null, null|integer  $limit = null) : array

Fire event

Parameters

string $eventName

Event to fire. You can also use wildcards to fire multiple events at once, ex: 'event.*'

array|\app\framework\Component\EventManager\Event $data

Array or Event object

null $resultType

If specified, the event results will be filtered using given class/interface name

null|integer $limit

Number of results to return

Throws

\app\framework\Component\StdLib\StdObject\StringObject\StringObjectException

Returns

array —

Array of results from EventListeners

enable()

enable() : $this

Enable event handling

After calling this method EventManager will process all fired events.

Returns

$this

disable()

disable() : $this

Disable event handling

After calling this method EventManager will ignore all fired events.

Returns

$this

getEventListeners()

getEventListeners(  $eventName) : array

Get array of event listeners

Parameters

$eventName

Returns

array

serialize()

serialize(  $value) : string

Serializes the given value.

Parameters

$value

Returns

string

unserialize()

unserialize(string  $string) : array|mixed

Unserializes the given string and returns the array.

Parameters

string $string

String to serialize.

Returns

array|mixed

init()

init() 

Singleton constructor

__construct()

__construct() 

The constructor is set to private to prevent creating new instances.

If you want to fire a function after the singleton instance is created, just implement 'init' method into your class.

__wakeup()

__wakeup() 

Declare it as private.

__clone()

__clone() 

Declare it as private.

fireWildcardEvents()

fireWildcardEvents(  $eventName,   $data,   $resultType) : null|array

Process events starting with given prefix (ex: framy.* will process all events starting with 'framy.')

Parameters

$eventName
$data
$resultType

Throws

\app\framework\Component\StdLib\StdObject\StringObject\StringObjectException

Returns

null|array