Blesta Source Documentation

WebhooksEvents extends WebhooksModel

Webhook Events

Table of Contents

Properties

$observer_dirs
$observers
$parent_class

Methods

__construct() Caches the event observers
getAll() Returns a list of all available events
getMethods() Returns a list of all methods available for a specific observer
getObservers() Returns a list of all observers available in the system.
listen() Listens to all events and triggers outgoing webhooks
trigger() Triggers an event
getFields() Returns the mapped fields from an event
pluginsHaveChanged() Check if the list of installed plugins has changed since the last time we fetched observers
Properties

$observer_dirs

private array<string|int, mixed> $observer_dirs = [\COREDIR . 'Util' . \DS . 'Events' . \DS . 'Observers', \PLUGINDIR]

A list of directories where the event observers are located

$observers

private array<string|int, mixed> $observers = []

Stores a list of all the loaded observers for the current instance

$parent_class

private string $parent_class = 'Blesta\Core\Util\Events\Observer'

The parent class all observers must inherit

Methods

__construct()

Caches the event observers

public __construct() : mixed

getAll()

Returns a list of all available events

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

A list of all events available in the system

getMethods()

Returns a list of all methods available for a specific observer

public getMethods(mixed $observer) : array<string|int, mixed>
Parameters
$observer : mixed

The instance of the Observable object or the name of the event

Return values
array<string|int, mixed>

Returns a list of methods supported by the observer

getObservers()

Returns a list of all observers available in the system.

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

Returns an array of arrays, each one containing the class and file of the system observers

listen()

Listens to all events and triggers outgoing webhooks

public listen(EventInterface $event[, int $webhook_id = null ]) : mixed
Parameters
$event : EventInterface

The triggered event

$webhook_id : int = null

The ID of the webhook used to trigger the event (optional)

trigger()

Triggers an event

public trigger(int $webhook_id[, array<string|int, mixed> $params = [] ][, array<string|int, mixed> $events = null ]) : array<string|int, mixed>
Parameters
$webhook_id : int

The ID of the webhook to trigger the event

$params : array<string|int, mixed> = []

An array of parameters to be held by this event (optional)

$events : array<string|int, mixed> = null

The events to be triggered by the incoming webhook (optional)

Return values
array<string|int, mixed>

The list of parameters that were submitted along with any modifications made to them by the event handlers. In addition a return item is included with the return array from the event.

getFields()

Returns the mapped fields from an event

private getFields(int $webhook_id, array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
$webhook_id : int

The ID of the webhook

$data : array<string|int, mixed>

The unmapped fields for the event

Return values
array<string|int, mixed>

An array containing the fields for the event

pluginsHaveChanged()

Check if the list of installed plugins has changed since the last time we fetched observers

private pluginsHaveChanged() : bool
Return values
bool

True if the list of plugins have changed

Tags
subpackage

plugins.webhooks

copyright

Copyright (c) 2023, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results