Back to AbstractEvent class

Method setArgument

public $this
setArgument
(mixed $name, mixed $value)
Add argument to event. It will use a setter method if one exists. The setters have the signature:
Parameters
  • string $name Argument name.
  • mixed $value Value.
Returns
  • $this
Since
  • 4.0.0
Class: AbstractEvent
Project: Joomla

Method setArgument - Source code

/**
 * Add argument to event. It will use a setter method if one exists. The setters have the signature:
 *
 * set<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.
 *
 * @param   string  $name   Argument name.
 * @param   mixed   $value  Value.
 *
 * @return  $this
 *
 * @since   4.0.0
 */
public function setArgument($name, $value)
{
    $methodName = 'set' . ucfirst($name);
    if (method_exists($this, $methodName)) {
        $value = $this->{$methodName}($value);
    }
    return parent::setArgument($name, $value);
}