Emitter
Adds event related features to any class.
trait Winter\Storm\Support\Traits\Emitter
Properties
protected
$emitterEventCollection
:
array
= []
Collection of registered events.
protected
$emitterEventSorted
:
array
= []
Sorted collection of events.
protected
$emitterSingleEventCollection
:
array
= []
Collection of registered events to be fired once only.
Methods
public
bindEvent (string | Closure | QueuedClosure $event, mixed $callback = null
, integer $priority)
: self
Create a new event binding.
Property | Type | Description |
---|---|---|
$event | string | Closure | QueuedClosure |
string | Closure | QueuedClosure
|
$callback | mixed |
mixed
when the third parameter is omitted and a Closure or QueuedClosure is provided this parameter is used as an integer this is used as priority variable |
$priority | integer |
integer
|
public
bindEventOnce (string | Closure | QueuedClosure $event, QueuedClosure | Closure | null $callback = null
)
: self
Create a new event binding that fires once only
Property | Type | Description |
---|---|---|
$event | string | Closure | QueuedClosure |
string | Closure | QueuedClosure
|
$callback | QueuedClosure | Closure | null |
QueuedClosure | Closure | null
When a Closure or QueuedClosure is provided as the first parameter this parameter can be omitted |
public
fireEvent (string $event, array $params = []
, boolean $halt = false
)
: array | mixed | null
Fire an event and call the listeners.
Property | Type | Description |
---|---|---|
$event | string |
string
Event name |
$params | array |
array
Event parameters |
$halt | boolean |
boolean
Halt after first non-null result |
If halted, the first non-null result. If not halted, an array of event results. Returns null if no listeners returned a result.
public
unbindEvent (string | array | object $event = null
)
: self
Destroys an event binding.
Property | Type | Description |
---|---|---|
$event | string | array | object |
string | array | object
Event to destroy |
protected emitterEventSortEvents (string $eventName) : void
Sort the listeners for a given event by priority.
Property | Type | Description |
---|---|---|
$eventName | string |
string
|
protected
parseEventAndPayload (mixed $event, mixed $payload = null
)
: array
Parse the given event and payload and prepare them for dispatching.
Property | Type | Description |
---|---|---|
$event | mixed |
mixed
|
$payload | mixed |
mixed
|
Used by
Class | Description |
---|---|
File
|
File attachment model |
Parameter
|
Parameters model Used for storing internal application parameters. |
Revision
|
Revision history model |
User
|
Administrator user model |
UserGroup
|
Administrator group |
UserPreference
|
All preferences for the backend user |
UserRole
|
Administrator role |
UserThrottle
|
Administrator throttling model |
ServerEventDataSource
|
The server-event data source for the Table widget. |
AutoDatasource
|
Datasource that loads from other data sources automatically |
CmsCompoundObject
|
This is a base class for CMS objects that have multiple sections - pages, partials and layouts. |
CmsObject
|
This is a base class for all CMS objects - content files, pages, partials and layouts. |
Content
|
The CMS content file class. |
Layout
|
The CMS layout class. |
Meta
|
The CMS meta file class, used for interacting with YAML files within the Halcyon datasources |
Page
|
The CMS page class. |
Partial
|
The CMS partial class. |
Theme
|
This class represents the CMS theme. |
Group
|
Group model |
Preferences
|
User Preferences model |
Role
|
Role model |
Throttle
|
Throttle model |
User
|
User model |
File
|
File attachment model |
Model
|
Active Record base class. |
DeferredBinding
|
Deferred Binding Model |
Revision
|
Revision Model |
MorphPivot
|
Reimplementation of \Illuminate\Database\Eloquent\Relations\MorphPivot but extends Winter's Pivot base class instead of Laravel's to get access to Winter magic. |
Pivot
|
|
Datasource
|
Datasource base class. |
DbDatasource
|
Database based data source |
FileDatasource
|
File based datasource. |
Model
|
This is a base template object. Equivalent to a Model in ORM. |
Mailer
|
Mailer class for sending mail. |
Markdown
|
Markdown parser. |