Back to WebAssetItem class

Method __construct

public
__construct
(string $name, string $uri = null, array $options = [], array $attributes = [], array $dependencies = [])
Class constructor
Parameters
  • string $name The asset name
  • string $uri The URI for the asset
  • array $options Additional options for the asset
  • array $attributes Attributes for the asset
  • array $dependencies Asset dependencies
Since
  • 4.0.0
Class: WebAssetItem
Project: Joomla

Method __construct - Source code

/**
 * Class constructor
 *
 * @param   string  $name          The asset name
 * @param   string  $uri           The URI for the asset
 * @param   array   $options       Additional options for the asset
 * @param   array   $attributes    Attributes for the asset
 * @param   array   $dependencies  Asset dependencies
 *
 * @since   4.0.0
 */
public function __construct(string $name, string $uri = null, array $options = [], array $attributes = [], array $dependencies = [])
{
    $this->name = $name;
    $this->uri = $uri;
    if (array_key_exists('version', $options)) {
        $this->version = $options['version'];
        unset($options['version']);
    }
    if (array_key_exists('attributes', $options)) {
        $this->attributes = (array) $options['attributes'];
        unset($options['attributes']);
    } else {
        $this->attributes = $attributes;
    }
    if (array_key_exists('dependencies', $options)) {
        $this->dependencies = (array) $options['dependencies'];
        unset($options['dependencies']);
    } else {
        $this->dependencies = $dependencies;
    }
    $this->options = $options;
}