Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de l'espace de nommage Joomla\CMS\Event\Result

Structures de données

interface  ResultAwareInterface
 

Fonctions

 addResult ($data)
 
 setResult (array $value)
 
 typeCheckResult ($data)
 

Variables

trait ResultAware
 
trait ResultTypeArrayAware
 
 $resultIsFalseable = false
 
trait ResultTypeBooleanAware
 
trait ResultTypeFloatAware
 
trait ResultTypeIntegerAware
 
trait ResultTypeNumericAware
 
trait ResultTypeObjectAware
 
 $resultAcceptableClasses = []
 
trait ResultTypeStringAware
 

Description détaillée

Joomla! Content Management System

Documentation des fonctions

◆ addResult()

Joomla\CMS\Event\Result\addResult (   $data)

Appends data to the result array of the event.

Paramètres
mixed$dataWhat to add to the result array.
Renvoie
void
Depuis
4.2.0

Références $data, $this, class, et Joomla\CMS\Event\Result\typeCheckResult().

Référencé par Joomla\CMS\Event\Result\setResult().

◆ setResult()

Joomla\CMS\Event\Result\setResult ( array  $value)
protected

Handle setting the result argument directly.

This method serves a dual purpose: backwards compatibility and enforcing the use of addResult.

When $this->preventSetArgumentResult is false it acts as a backwards compatibility shim for event handlers expecting generic event classes instead of the concrete Events implemented in this package. This allows the migration to concrete event classes throughout the lifetime of Joomla 4.x.

When $this->preventSetArgumentResult is false (which will always be the case on Joomla 5.0) it will throw a BadMethodCallException if the developer tries to call setArgument('result', ...) instead of going through the addResult() method.

Paramètres
array$valueThe new result array.
Renvoie
array
Depuis
4.2.0

Références $value, et Joomla\CMS\Event\Result\addResult().

◆ typeCheckResult()

typeCheckResult (   $data)

Checks the type of the data being appended to the result argument.

Paramètres
mixed$dataThe data to type check
Renvoie
void
Exceptions
InvalidArgumentException

Références $data, et null.

Référencé par Joomla\CMS\Event\Result\addResult().

Documentation des variables

◆ $resultAcceptableClasses

$resultAcceptableClasses = []
protected

◆ $resultIsFalseable

$resultIsFalseable = false
protected

◆ ResultAware

trait ResultAware
Valeur initiale :
{
protected $preventSetArgumentResult = false

This Trait partially implements the ResultAwareInterface for mutable and immutable events.

You must additionally implement the typeCheckResult method or use one of the ResultType*Aware traits in your Event handler.

Depuis
4.2.0

◆ ResultTypeArrayAware

trait ResultTypeArrayAware
Valeur initiale :
{
protected $resultIsNullable = false

This Trait partially implements the ResultAwareInterface for type checking.

Events using this Trait (and the ResultAware trait) will expect event handlers to set results of an Array type.

Depuis
4.2.0

◆ ResultTypeBooleanAware

trait ResultTypeBooleanAware
Valeur initiale :
{
protected $resultIsNullable = false

This Trait partially implements the ResultAwareInterface for type checking.

Events using this Trait (and the ResultAware trait) will expect event handlers to set results of a Boolean type.

Depuis
4.2.0

◆ ResultTypeFloatAware

trait ResultTypeFloatAware
Valeur initiale :
{
protected $resultIsNullable = false

This Trait partially implements the ResultAwareInterface for type checking.

Events using this Trait (and the ResultAware trait) will expect event handlers to set results of a Float type.

Depuis
4.2.0

◆ ResultTypeIntegerAware

trait ResultTypeIntegerAware
Valeur initiale :
{
protected $resultIsNullable = false

This Trait partially implements the ResultAwareInterface for type checking.

Events using this Trait (and the ResultAware trait) will expect event handlers to set results of an Integer type.

Depuis
4.2.0

◆ ResultTypeNumericAware

trait ResultTypeNumericAware
Valeur initiale :
{
protected $resultIsNullable = false

This Trait partially implements the ResultAwareInterface for type checking.

Events using this Trait (and the ResultAware trait) will expect event handlers to set results of a Numeric type.

Depuis
4.2.0

◆ ResultTypeObjectAware

trait ResultTypeObjectAware
Valeur initiale :
{
protected $resultIsNullable = false

This Trait partially implements the ResultAwareInterface for type checking.

Events using this Trait (and the ResultAware trait) will expect event handlers to set results of an object type.

If you do not set a list of acceptable result classes any PHP object will satisfy this type check.

Depuis
4.2.0

◆ ResultTypeStringAware

trait ResultTypeStringAware
Valeur initiale :
{
protected $resultIsNullable = false

This Trait partially implements the ResultAwareInterface for type checking.

Events using this Trait (and the ResultAware trait) will expect event handlers to set results of a String type.

Depuis
4.2.0