Subscription
extends SubscriptionBase
in package
The EventDispatcherInterface is the central point of Symfony's event listener system.
Listeners are registered on the manager and events are dispatched through the manager.
Table of Contents
Constants
- EVENT_NOTIFICATION : mixed = 'notification'
- EVENT_REMOVE_ERROR : mixed = 'removeError'
- EVENT_REMOVE_SUCCESS : mixed = 'removeSuccess'
- EVENT_RENEW_ERROR : mixed = 'renewError'
- EVENT_RENEW_SUCCESS : mixed = 'renewSuccess'
- EVENT_SUBSCRIBE_ERROR : mixed = 'subscribeError'
- EVENT_SUBSCRIBE_SUCCESS : mixed = 'subscribeSuccess'
- EVENT_TIMEOUT : mixed = 'timeout'
Properties
- $_eventFilters : array<string|int, string>
- $_platform : Platform
- $_subscription : array<string|int, mixed>
- $_webSocket : WebSocket
Methods
- __construct() : mixed
- addEvents() : $this
- addListener() : void
- Adds an event listener that listens on the specified events.
- addSubscriber() : void
- Adds an event subscriber.
- alive() : bool
- dispatch() : T
- Dispatches an event to all registered listeners.
- getListenerPriority() : int|null
- Gets the listener priority for a specific event.
- getListeners() : array<string|int, array<string|int, callable>|callable>
- Gets the listeners of a specific event or all listeners sorted by descending priority.
- hasListeners() : bool
- Checks whether an event has any registered listeners.
- register() : ApiResponse|$this
- removeListener() : void
- Removes an event listener from the specified events.
- removeSubscriber() : void
- renew() : mixed
- reset() : mixed
- setEvents() : $this
- setSubscription() : $this
- subscribe() : Subscription
- subscribed() : bool
- subscription() : array<string|int, mixed>
- callListeners() : void
- Triggers the listeners of an event.
- getFullEventFilters() : array<string|int, mixed>
- onNotification() : mixed
Constants
EVENT_NOTIFICATION
public
mixed
EVENT_NOTIFICATION
= 'notification'
EVENT_REMOVE_ERROR
public
mixed
EVENT_REMOVE_ERROR
= 'removeError'
EVENT_REMOVE_SUCCESS
public
mixed
EVENT_REMOVE_SUCCESS
= 'removeSuccess'
EVENT_RENEW_ERROR
public
mixed
EVENT_RENEW_ERROR
= 'renewError'
EVENT_RENEW_SUCCESS
public
mixed
EVENT_RENEW_SUCCESS
= 'renewSuccess'
EVENT_SUBSCRIBE_ERROR
public
mixed
EVENT_SUBSCRIBE_ERROR
= 'subscribeError'
EVENT_SUBSCRIBE_SUCCESS
public
mixed
EVENT_SUBSCRIBE_SUCCESS
= 'subscribeSuccess'
EVENT_TIMEOUT
public
mixed
EVENT_TIMEOUT
= 'timeout'
Properties
$_eventFilters
protected
array<string|int, string>
$_eventFilters
= []
$_platform
protected
Platform
$_platform
$_subscription
protected
array<string|int, mixed>
$_subscription
= [
'eventFilters' => [],
'expirationTime' => '',
// 2014-03-12T19:54:35.613Z
'expiresIn' => 0,
'deliveryMode' => ['transportType' => 'PubNub', 'encryption' => false, 'address' => '', 'subscriberKey' => '', 'secretKey' => ''],
'id' => '',
'creationTime' => '',
// 2014-03-12T19:54:35.613Z
'status' => '',
// Active
'uri' => '',
]
$_webSocket
protected
WebSocket
$_webSocket
Methods
__construct()
public
__construct(Platform $platform, WebSocket $webSocket) : mixed
Parameters
addEvents()
public
addEvents(array<string|int, mixed> $events) : $this
Parameters
- $events : array<string|int, mixed>
Return values
$thisaddListener()
Adds an event listener that listens on the specified events.
public
addListener(string $eventName, callable|array<string|int, mixed> $listener[, int $priority = 0 ]) : void
Parameters
- $eventName : string
- $listener : callable|array<string|int, mixed>
- $priority : int = 0
-
The higher this value, the earlier an event listener will be triggered in the chain (defaults to 0)
addSubscriber()
Adds an event subscriber.
public
addSubscriber(EventSubscriberInterface $subscriber) : void
The subscriber is asked for all the events it is interested in and added as a listener for these events.
Parameters
- $subscriber : EventSubscriberInterface
alive()
public
alive() : bool
Return values
booldispatch()
Dispatches an event to all registered listeners.
public
dispatch(object $event[, string|null $eventName = null ]) : T
Parameters
- $event : object
-
The event to pass to the event handlers/listeners
- $eventName : string|null = null
-
The name of the event to dispatch. If not supplied, the class of $event should be used instead.
Return values
T —The passed $event MUST be returned
getListenerPriority()
Gets the listener priority for a specific event.
public
getListenerPriority(string $eventName, callable|array<string|int, mixed> $listener) : int|null
Returns null if the event or the listener does not exist.
Parameters
- $eventName : string
- $listener : callable|array<string|int, mixed>
Return values
int|nullgetListeners()
Gets the listeners of a specific event or all listeners sorted by descending priority.
public
getListeners([string|null $eventName = null ]) : array<string|int, array<string|int, callable>|callable>
Parameters
- $eventName : string|null = null
Return values
array<string|int, array<string|int, callable>|callable>hasListeners()
Checks whether an event has any registered listeners.
public
hasListeners([string|null $eventName = null ]) : bool
Parameters
- $eventName : string|null = null
Return values
boolregister()
public
register([array<string|int, mixed> $options = [] ]) : ApiResponse|$this
Parameters
- $options : array<string|int, mixed> = []
Tags
Return values
ApiResponse|$thisremoveListener()
Removes an event listener from the specified events.
public
removeListener(string $eventName, callable|array<string|int, mixed> $listener) : void
Parameters
- $eventName : string
- $listener : callable|array<string|int, mixed>
removeSubscriber()
public
removeSubscriber(EventSubscriberInterface $subscriber) : void
Parameters
- $subscriber : EventSubscriberInterface
renew()
public
renew([array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $options : array<string|int, mixed> = []
reset()
public
reset() : mixed
setEvents()
public
setEvents(array<string|int, mixed> $events) : $this
Parameters
- $events : array<string|int, mixed>
Return values
$thissetSubscription()
public
setSubscription(array<string|int, mixed> $subscription) : $this
Parameters
- $subscription : array<string|int, mixed>
Return values
$thissubscribe()
public
subscribe([array<string|int, mixed> $options = [] ]) : Subscription
Parameters
- $options : array<string|int, mixed> = []
Tags
Return values
Subscriptionsubscribed()
public
subscribed() : bool
Return values
boolsubscription()
public
subscription() : array<string|int, mixed>
Return values
array<string|int, mixed>callListeners()
Triggers the listeners of an event.
protected
callListeners(array<string|int, callable> $listeners, string $eventName, object $event) : void
This method can be overridden to add functionality that is executed for each listener.
Parameters
- $listeners : array<string|int, callable>
-
The event listeners
- $eventName : string
-
The name of the event to dispatch
- $event : object
-
The event object to pass to the event handlers/listeners
getFullEventFilters()
protected
getFullEventFilters() : array<string|int, mixed>
Return values
array<string|int, mixed>onNotification()
protected
onNotification(mixed $event) : mixed
Parameters
- $event : mixed