Validate

Extends AbstractImmutableEvent Implements ResultAwareInterface

Concrete Event class for the onUserMultifactorValidate event

since

4.2.0

package

Joomla CMS

Methods

__construct

Public constructor

__construct(\Joomla\Component\Users\Administrator\Table\MfaTable record, \Joomla\CMS\User\User user,  code) : 
since

4.2.0

Arguments

record

MfaTableThe MFA record to validate against

user

UserThe user currently logged into the site

code

stringThe MFA code we are validating

Response

mixed

addResult

Appends data to the result array of the event.

addResult( data) : 
inherited
since

4.2.0

Arguments

data

mixedWhat to add to the result array.

Response

void

create

Creates a new CMS event object for a given event name and subject. The following arguments must be given: subject object The subject of the event. This is the core object you are going to manipulate.

create( eventName, mixed||string|int arguments = []) : 
inherited static

eventClass string The Event class name. If you do not provide it Joomla\CMS\Events<eventNameWithoutOnPrefix> will be used.

since

4.0.0

throws

BadMethodCallExceptionIf you do not provide a subject argument

Arguments

eventName

stringThe name of the event, e.g. onTableBeforeLoad

arguments

array<string|int, mixed>Additional arguments to pass to the event

Response

static

getArgument

Get an event argument value.

getArgument( name,  default = null) : 
inherited

It will use a pre-processing method if one exists. The method has the signature:

onGet<ArgumentName>($value): mixed

where:

$value is the value currently stored in the $arguments array of the event It returns the value to return to the caller.

since

4.0.0

Arguments

name

stringThe argument name.

default

mixedThe default value if not found.

Response

mixedThe argument value or the default value.

getEventClassByEventName

Get the concrete event class name for the given event name.

getEventClassByEventName( eventName) : 
inherited static

This method falls back to the generic Joomla\Event\Event class if the event name is unknown to this trait.

since

4.2.0

Arguments

eventName

stringThe event name

Response

stringThe event class name

offsetSet

Set the value of an event argument.

offsetSet( name,  value) : 
inherited
since

4.0.0

throws

BadMethodCallException

Arguments

name

stringThe argument name.

value

mixedThe argument value.

Response

void

offsetUnset

Remove an event argument.

offsetUnset( name) : 
inherited
since

4.0.0

throws

BadMethodCallException

Arguments

name

stringThe argument name.

Response

void

onSetCode

Validate the value of the 'code' named parameter

onSetCode(string|null value) : string|null
since

4.4.0

Arguments

value

string|nullThe value to validate

Response

string|null

onSetRecord

Validate the value of the 'record' named parameter

onSetRecord(\Joomla\Component\Users\Administrator\Table\MfaTable value) : \Joomla\Component\Users\Administrator\Table\MfaTable
since

4.4.0

Arguments

value

MfaTableThe value to validate

Response

MfaTable

onSetResult

Handle setting the result argument directly.

onSetResult(mixed||string|int value) : mixed||string|int
inherited

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.

since

4.4.0

Arguments

value

array<string|int, mixed>The new result array.

Response

array<string|int, mixed>

onSetUser

Validate the value of the 'user' named parameter

onSetUser(\Joomla\CMS\User\User value) : \Joomla\CMS\User\User
since

4.4.0

Arguments

value

UserThe value to validate

Response

User

setArgument

Add argument to event.

setArgument( name,  value) : 
inherited

It will use a pre-processing method if one exists. The method has the signature:

onSet<ArgumentName>($value): mixed

where:

$value is the value being set by the user It returns the value to return to set in the $arguments array of the event.

since

4.0.0

Arguments

name

stringArgument name.

value

mixedValue.

Response

$this

setCode

Validate the value of the 'code' named parameter

setCode(string|null value) : string|null
deprecated
since

4.2.0

deprecated

4.4.0 will be removed in 6.0 Use counterpart with onSet prefix

Arguments

value

string|nullThe value to validate

Response

string|null

setRecord

Validate the value of the 'record' named parameter

setRecord(\Joomla\Component\Users\Administrator\Table\MfaTable value) : \Joomla\Component\Users\Administrator\Table\MfaTable
deprecated
since

4.2.0

deprecated

4.4.0 will be removed in 6.0 Use counterpart with onSet prefix

Arguments

value

MfaTableThe value to validate

Response

MfaTable

setResult

Handle setting the result argument directly.

setResult(mixed||string|int value) : mixed||string|int
inherited deprecated

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.

since

4.2.0

deprecated

4.4.0 will be removed in 6.0 Use counterpart with onSet prefix

Arguments

value

array<string|int, mixed>The new result array.

Response

array<string|int, mixed>

setUser

Validate the value of the 'user' named parameter

setUser(\Joomla\CMS\User\User value) : \Joomla\CMS\User\User
deprecated
since

4.2.0

deprecated

4.4.0 will be removed in 6.0 Use counterpart with onSet prefix

Arguments

value

UserThe value to validate

Response

User

Properties

eventNameToConcreteClass

Maps event names to concrete Event classes.

inherited static

This is only for events with invariable names. Events with variable names are handled with PHP logic in the getEventClassByEventName class.

since

4.2.0

Type(s)

array<string|int, mixed>

constructed

A flag to see if the constructor has been already called.

inherited
since

4.0.0

Type(s)

bool

resultIsNullable

Can the result attribute values also be NULL?

inherited
since

4.2.0

Type(s)

bool

preventSetArgumentResult

Disallow setting the result argument directly with setArgument() instead of going through addResult().

inherited deprecated

You should set this to true ONLY for event names which did NOT exist before Joomla 4.2.0 or if you are a third party developer introducing new event names for use only in your software.

since

4.2.0

deprecated

4.3 will be removed in 6.0 Using setResult() for the result argument will always be disallowed.

Type(s)

bool