Back to OnGetApiFields class

Method setType

protected mixed
setType
(mixed $value)
Setter for the type argument
Parameters
  • int $value The constant from VIEW_TYPE
Returns
  • mixed
-
  • \BadMethodCallException if the argument is not of the expected type

Method setType - Source code

/**
 * Setter for the type argument
 *
 * @param   integer  $value  The constant from VIEW_TYPE
 *
 * @return  mixed
 *
 * @throws  BadMethodCallException  if the argument is not of the expected type
 */
protected function setType($value)
{
    if (!in_array($value, [static::ITEM, static::LIST])) {
        throw new BadMethodCallException("Argument 'type' of event {$this->name} must be a valid value");
    }
    return $value;
}