Alias add an asset to container.

@param string $name
@param string $source
@param array  $dependencies
@param array  $attributes
434675
public function add($name, $source, $dependencies = array(), $attributes = array())
    {
        $this->added($name, $source, $dependencies, $attributes);
    }
975241
public function custom(string $name, array $attributes): Custom
    {
        /** @var ContainerElement $this */
        return $this->addElement(Custom::factory($name, $attributes));
    }
982903
public function setAlias(string $name, $alias): void
    {
        foreach ((array)$alias as $aliasName) {
            if (!isset($this->aliases[$aliasName])) {
                $this->aliases[$aliasName] = $name;
            }
        }
    }
230636
public function addAsset($type, $assetName, $fileName, $dependencies = array())
    {
        if (!isset($this->assets[$type]) || !is_array($this->assets[$type])) {
            $this->assets[$type] = array();
        }
        
        $asset = new Asset(
            $type,
            $assetName,
            $this->buildSourceFilePath($fileName),
            $dependencies
        );
        
        $this->assets[$type][$assetName] = $asset;
        $this->saveAssets();
    }
1086442
public function save($name, $attributes = [])
    {
        if (auth()->guest()) {
            return;
        }
        $params          = [
            'uid'      => auth()->user()->id,
            'brand_id' => brand_id(),
            'resource' => uri(),
            'name'     => snake_case($name),
            'data'     => $attributes,
        ];
        $this->cache->forget($this->cacheKey($params));
        $wid             = $this->getComponentId($name);
        $params['wid']   = $wid;
        $componentParams = ComponentParams::firstOrNew($params);
        $componentParams->save();
        return $componentParams;
    }
378293
public function remove($name)
    {
        try {
            $this->fs->remove($this->rootPath . DIRECTORY_SEPARATOR . 'www' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $name);
        } catch (IOException $e) {
            throw new RuntimeException(
                sprintf('Unable to remove assets for plugin %s', $name), $e->getCode(), $e
            );
        }
    }
34456
public function buildPropertyPreg($named, $attributes)
    {
        if ($named) {
            $this->resultOffsets['named'] = $this->startOffset + 3;
            $this->propertyPreg .= "([\$]smarty[.]{$this->tagName}[.]{$attributes['name']}[.](";
            $properties = $this->nameProperties;
        } else {
            $this->resultOffsets['item'] = $this->startOffset + 3;
            $this->propertyPreg .= "([\$]{$attributes['item']}[@](";
            $properties = $this->itemProperties;
        }
        $this->startOffset += count($properties) + 2;
        $propName = reset($properties);
        while ($propName) {
            $this->propertyPreg .= "({$propName})";
            $propName = next($properties);
            if ($propName) {
                $this->propertyPreg .= '|';
            }
        }
        $this->propertyPreg .= '))';
    }
169836
public function add_data_source( \Serializable $source, $name = '' ) {

		if ( $name ) {
			$this->data_sources[ $name ] = $source;
		} else {
			$this->data_sources[] = $source;
		}

		$this->regenerate();

		return $this;
	}
59023
public function add($name, $filename, array $attributes = array())
    {
        // Check if the file exists
        if(!file_exists($filename))
        {
            // The file doesn't exist, so throw an exception
            throw new Exception(Lang::get('assetprocessor::errors.asset.file-not-found', array('file' => $filename)));
        }

        // Figure out which asset group we are in
        $group = isset($attributes['group']) ? $attributes['group'] : $this->getGroup();

        // Grab the file information
        $file = new SplFileInfo($filename);

        // Check if the file is a directory
        if($file->isDir())
        {
            // It was a directory, so iterate through it
            $directory = new DirectoryIterator($filename);

            foreach ($directory as $file)
            {
                // Make sure we aren't the dot directory
                if(!$file->isDot())
                {
                    // Recursively call the add function
                    $this->add($name . $file->getFilename(), $file->getRealPath(), $attributes);
                }
            }
        }
        else
        {
            // Check if there is a file extension mapped
            if(isset($this->extensionMapping[$file->getExtension()]))
            {
                $file_to_process = $file->getRealPath();

                // Whether or not we at least generate a file
                $generateFile = true;

                // Check if the file is in webroot
                if(!Str::contains($file_to_process, public_path()))
                {
                    // It isn't, so force the processing
                    $generateFile = true;
                }

                // Keep track of the actual asset type that is being processed
                $assetType = null;

                // There was something linked to it, so iterate through
                foreach($this->extensionMapping[$file->getExtension()] as $processor)
                {
                    // Check the processor type to make sure we aren't classifying
                    // it as two different types
                    if($assetType !== null && $this->processors[$processor]->getAssetType() != $assetType)
                    {
                        // There is a mismatch, so throw an exception
                        throw new Exception(Lang::get('assetprocessor::errors.asset.different-asset-types', array('file' => $file_to_process)));
                    }
                    // Was there a duplicate name, and we are erroring
                    else if(isset($this->files[$assetType][$name]) && config('assetprocessor.file.error-on-duplicate-name', false))
                    {
                        // We are erroring because of the duplicate name, so throw an exception
                        throw new Exception(Lang::get('assetprocessor::errors.asset.duplicate-name', array('name' => $name)));
                    }

                    // Check if we should be processing the file
                    if($this->processingEnabled || $this->processors[$processor]->bypassProcess())
                    {
                        // It is so, process the file
                        $file_to_process = $this->processors[$processor]->process($file_to_process, $file->getFileName());
                    }

                    // Set the asset type
                    $assetType = $this->processors[$processor]->getAssetType();
                }

                // Check if the file was processed
                if($file_to_process != $file->getRealPath())
                {
                    // Build the metadata file name
                    $metadata = dirname($file_to_process) . '/metadata';

                    // Does the file exist?
                    if(!file_exists($metadata) || (file_exists($metadata) && filemtime($metadata) < filemtime($file_to_process)))
                    {
                        // Derive the new file name
                        $output = md5(file_get_contents($file_to_process));

                        // Write out the metadata file for next time
                        file_put_contents($metadata, $output);

                        // It was, so add it to the base folder
                        $dest_path = config('assetprocessor.cache.directory') . '/' . $assetType . '/' . $output;

                        // Copy the file over
                        copy($file_to_process, $dest_path);

                        // Grab the file name to add to our asset list
                        $file_to_process = basename($dest_path);
                    }
                    else
                    {
                        // Otherwise, just read the metadata file
                        $file_to_process = file_get_contents($metadata);

                        // Touch the file, so we know it's active
                        touch($metadata);
                    }

                }
                // Check if we need to generate a files
                else if($file_to_process == $file->getRealPath() && $generateFile)
                {
                    // Figure out the type of the file
                    $type = $file->getExtension();

                    // We need to generate the file, so make a copy of it in the storage folder
                    $file_to_process = $this->write($type, $file_to_process);
                }

                // Add it to the list of files that we processed
                $this->files[$assetType][$group][$name] = $file_to_process;
            }

            // Does the final location for the file match the current path?
            if(config('assetprocessor.cache.directory') != config('assetprocessor.cache.external', config('assetprocessor.cache.directory')))
            {
                // Derive the source path
                $source = config('assetprocessor.cache.directory') . '/' . $assetType . '/' . basename($file_to_process);

                // Derive the destination path
                $destination = config('assetprocessor.cache.external', config('assetprocessor.cache.directory')) . '/' . $assetType . '/' . basename($file_to_process) . '.' . $assetType;

                // Was the final resting spot written later than the regular file?
                if(!file_exists($destination) || (filemtime($source) < filemtime($destination)))
                {
                    // Copy the file over
                    copy($source, $destination);
                }

                // Overwrite the path (only if it is a public URL)
                if(Str::contains($destination, public_path()))
                {
                    $this->files[$assetType][$group][$name] = $destination;
                }
            }
        }
    }
449077
public function add($alias, $source = null, $dependencies = [], $options = [])
    {
        if ($source !== null) {
            $asset = $this->_factory->create($alias, $source, $dependencies, $options);
            $this->_collection->add($asset);
        }

        $this->_queued[$alias] = true;

        return $this;
    }
1023205
public function generate(string $name, array $attributes = [], ?string $prefix = null): string
    {
        $prefix = $prefix ?? $this->prefix ?? "";

        $route = $this->routes->oneNamed($name);

        if ($route === null) {
            throw RouteNotFound::named($name);
        }

        $path = $route->getPath();

        $uri = $this->uriFactory->create($path, $attributes);

        return $prefix . $uri;
    }
1370231
public function localize(string $name, array $data): AssetInterface
    {
        $this->localize[$name] = $data;

        return $this;
    }
75436
public function writeScript($name, $source, $dependencies = array())
    {
        $source = '<script>'.$source.'</script>';

        return $this->write($name, 'script', $source, $dependencies);
    }
570363
public function addAttribute($name, $value = NULL, $namespace = NULL) {
		parent::addAttribute($name, ($value !== NULL ? str_replace('&', '&amp;', $value) : NULL), $namespace);
	}
1294255
protected function resolveDependenciesForAsset(&$assets, $asset, $replaces)
    {
        foreach ($assets as $name => $value) {
            $changed = false;

            foreach ($value['dependencies'] as $key => $dependency) {
                if (in_array($dependency, $replaces)) {
                    $changed = true;
                    unset($value['dependencies'][$key]);
                }
            }

            if ($changed) {
                $value['dependencies'][]       = $asset;
                $assets[$name]['dependencies'] = $value['dependencies'];
            }
        }

        $assets[$asset]['replaces'] = [];
    }
373828
protected function write($name, $type, $source, $dependencies = array())
    {
        $types = array(
            'script' => 'script',
            'style'  => 'style',
            'js'     => 'script',
            'css'    => 'style'
        );

        if (array_key_exists($type, $types))
        {
            $type = $types[$type];

            $this->register($type, $name, $source, $dependencies, array());
        }

        return $this;
    }
11196
public function addResource($name, $bundle, $format, $path = 'routing')
    {
        $resource = '@'.$bundle.$path.'.'.$format;
        $yaml = $this->getContent();
        if (!isset($yaml[$name]) || $yaml[$name]['resource'] != $resource) {
            $yaml[$name] = ['resource' => $resource];
            $this->setContent($yaml);
        }
    }