public getAttribute ( string $name ) : mixed | ||
$name | string | The attribute name |
return | mixed | The attribute value |
public function getAttribute($name)
{
if (!array_key_exists($name, $this->attributes)) {
throw new \InvalidArgumentException(sprintf('This token has no "%s" attribute.', $name));
}
return $this->attributes[$name];
}
/** * Returns an attribute as an array of values * @param string $name * @return array */ public function getArrayAttribute($name) { $value = parent::getAttribute($name); return is_array($value) ? $value : array($value); }