Back to AbstractEvent class

Method setSubject

protected \Joomla\CMS\Table\TableInterface
setSubject
(mixed $value)
Setter for the subject argument
Parameters
  • \Joomla\CMS\Table\TableInterface $value The value to set
Returns
  • \Joomla\CMS\Table\TableInterface
-
  • \BadMethodCallException If the argument is not of the expected type.
Class: AbstractEvent
Project: Joomla

Method setSubject - Source code

/**
 * Setter for the subject argument
 *
 * @param   TableInterface  $value  The value to set
 *
 * @return  TableInterface
 *
 * @throws  BadMethodCallException  If the argument is not of the expected type.
 */
protected function setSubject($value)
{
    if (!\is_object($value) || !$value instanceof TableInterface) {
        throw new BadMethodCallException("Argument 'subject' of event {$this->name} is not of the expected type");
    }
    return $value;
}