Elgg  Version 5.1
Public Member Functions | Protected Attributes | List of all members
Elgg\Event Class Reference

Models an event passed to event handlers. More...

Public Member Functions

 __construct (PublicContainer $dic, string $name, string $type, $value=null, $params=[])
 Constructor. More...
 
 getName ()
 Get the name of the event. More...
 
 getType ()
 Get the type of the event object. More...
 
 getObject ()
 Get the object of the event. More...
 
 getValue ()
 Get the current value of the event. More...
 
 setValue ($value)
 Update the value. More...
 
 getParams ()
 Get the parameters passed to the trigger call. More...
 
 getParam (string $key, $default=null)
 Get an element of the params array. More...
 
 getEntityParam ()
 Gets the "entity" key from the params if it holds an ElggEntity. More...
 
 getUserParam ()
 Gets the "user" key from the params if it holds an ElggUser. More...
 
 elgg ()
 Get the DI container. More...
 
 getSequenceID ()
 When the event is part of a sequence a unique ID is set for each sequence. More...
 

Protected Attributes

 $dic
 
 $name
 
 $type
 
 $value
 
 $params
 

Detailed Description

Models an event passed to event handlers.

Since
2.0.0

Definition at line 11 of file Event.php.

Constructor & Destructor Documentation

Elgg\Event::__construct ( PublicContainer  $dic,
string  $name,
string  $type,
  $value = null,
  $params = [] 
)

Constructor.

Parameters
PublicContainer$dicDI container
string$nameEvent name
string$typeEvent type
mixed$valueEvent value
mixed$paramsEvent params

Definition at line 47 of file Event.php.

Member Function Documentation

Elgg\Event::elgg ( )

Get the DI container.

Returns
PublicContainer

Definition at line 160 of file Event.php.

Elgg\Event::getEntityParam ( )

Gets the "entity" key from the params if it holds an ElggEntity.

Returns
|null

Definition at line 134 of file Event.php.

Elgg\Event::getName ( )

Get the name of the event.

Returns
string

Definition at line 60 of file Event.php.

Elgg\Event::getObject ( )

Get the object of the event.

Returns
mixed

Definition at line 78 of file Event.php.

Elgg\Event::getParam ( string  $key,
  $default = null 
)

Get an element of the params array.

If the params array is not an array, the default will always be returned.

Parameters
string$keyThe key of the value in the params array
mixed$defaultThe value to return if missing
Returns
mixed

Definition at line 121 of file Event.php.

Elgg\Event::getParams ( )

Get the parameters passed to the trigger call.

Returns
mixed

Definition at line 108 of file Event.php.

Elgg\Event::getSequenceID ( )

When the event is part of a sequence a unique ID is set for each sequence.

Returns
string|null

Definition at line 169 of file Event.php.

Elgg\Event::getType ( )

Get the type of the event object.

Returns
string

Definition at line 69 of file Event.php.

Elgg\Event::getUserParam ( )

Gets the "user" key from the params if it holds an ElggUser.

Returns
|null

Definition at line 147 of file Event.php.

Elgg\Event::getValue ( )

Get the current value of the event.

Returns
mixed

Definition at line 87 of file Event.php.

Elgg\Event::setValue (   $value)

Update the value.

Parameters
mixed$valueThe new value
Returns
void

Definition at line 99 of file Event.php.

Member Data Documentation

Elgg\Event::$dic
protected

Definition at line 16 of file Event.php.

Elgg\Event::$name
protected

Definition at line 21 of file Event.php.

Elgg\Event::$params
protected

Definition at line 36 of file Event.php.

Elgg\Event::$type
protected

Definition at line 26 of file Event.php.

Elgg\Event::$value
protected

Definition at line 31 of file Event.php.


The documentation for this class was generated from the following file: