Back to WebAssetItem class

Method getAttribute

public mixed
getAttribute
(string $key, mixed $default = null)
Get the attribute
Parameters
  • string $key An attributes key
  • string $default A default value
Returns
  • mixed
Since
  • 4.0.0
Class: WebAssetItem
Project: Joomla

Method getAttribute - Source code

/**
 * Get the attribute
 *
 * @param   string  $key      An attributes key
 * @param   string  $default  A default value
 *
 * @return mixed
 *
 * @since   4.0.0
 */
public function getAttribute(string $key, $default = null)
{
    if (array_key_exists($key, $this->attributes)) {
        return $this->attributes[$key];
    }
    return $default;
}