public \Joomla\CMS\WebAsset\WebAssetItem
createAsset
(string $name, string $uri = null, array $options = [], array $attributes = [], array $dependencies = [])
/**
* Prepare new Asset instance.
*
* @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
*
* @return WebAssetItem
*
* @since 4.0.0
*/
public function createAsset(string $name, string $uri = null, array $options = [], array $attributes = [], array $dependencies = []) : WebAssetItem
{
$nameSpace = \array_key_exists('namespace', $options) ? $options['namespace'] : __NAMESPACE__ . '\\AssetItem';
$className = \array_key_exists('class', $options) ? $options['class'] : null;
if ($className && class_exists($nameSpace . '\\' . $className)) {
$className = $nameSpace . '\\' . $className;
return new $className($name, $uri, $options, $attributes, $dependencies);
}
return new WebAssetItem($name, $uri, $options, $attributes, $dependencies);
}