Back to OnGetApiFields class

Method setFields

protected array
setFields
(mixed $value)
Setter for the fields argument
Parameters
  • mixed $value The value to set
Returns
  • array
-
  • \BadMethodCallException if the argument is not a non-empty array

Method setFields - Source code

/**
 * Setter for the fields argument
 *
 * @param   mixed  $value  The value to set
 *
 * @return  array
 *
 * @throws  BadMethodCallException  if the argument is not a non-empty array
 */
protected function setFields($value)
{
    if (!\is_array($value) || is_array($value) && empty($value)) {
        throw new BadMethodCallException("Argument 'fields' of event {$this->name} must be be an array and not empty");
    }
    return $value;
}