Add a JavaScript code to the registered assets.

@param  string  $name
@param  string  $source
@param  string|array  $dependencies
@param  string|array  $attributes
@param  string|array  $replaces
180093
public function inlineScript($name, $source = null, $dependencies = [], $attributes = [], $replaces = [])
    {
        $this->register('inline', $name, $source, $dependencies, $attributes, $replaces);
    }
1216172
public function addLocalScript($name, $src, array $depends = array(), $version = false, $footer = false) {
			$n = $this->getOptionPrefix() . $name;
			$s = $this->getPluginUrlRoot() . $src;

			return $this->addScript($n, $s, $depends, $version, $footer);
		}
394526
public function script($name, $source, $dependencies = array(), $attributes = array())
    {
        // Prepaend path to theme.
        if ($this->isUsePath()) {
            $source = $this->evaluatePath($this->getCurrentPath().$source);
        }

        $this->register('script', $name, $source, $dependencies, $attributes);

        return $this;
    }
43321
function addSourcePackage(name, node, type, opts) {
      var comments, sourcePackage;
      sourcePackage = {
        node: node,
        name: name,
        type: type,
        body: getNodeBody(node, true),
        module: moduleName,
        dependencies: getDependencies(node, name)
      };
      merge(sourcePackage, opts);
      comments = getLastCommentForNode(node, 1);
      if (comments) {
        sourcePackage.comments = comments;
        sourcePackage.bodyWithComments = comments + '\n' + sourcePackage.body;
      } else {
        sourcePackage.bodyWithComments = sourcePackage.body;
      }
      sourcePackages.push(sourcePackage);
      return sourcePackage;
    }
28030
public function namespaced($namespace, $attributes = [], Closure $callback = null): void
    {
        if ($attributes instanceof Closure) {
            $callback = $attributes;
            $attributes = [];
        }

        if (! empty($namespace) && $namespace != '\\') {
            $attributes['namespace'] = $namespace;
        }

        $attributes['middleware'] = \array_unique(\array_merge(
            $attributes['middleware'] ?? [], ['orchestra']
        ));

        $this->group('orchestra/foundation', 'orchestra', $attributes, $callback);
    }
1258343
function copy($name, $new_name, $update = false)
	{
		//replace not-allowed characters with _
		$new_name = preg_replace('/([^a-zA-Z0-9_])/', '_', $new_name);

		//initialise response element
		$result = array();
		$result['status'] = false;

		if ($name && $new_name) {
			//check to see if an integration was selected
			$db = Factory::getDBO();

			$query = $db->getQuery(true)
				->select('count(*)')
				->from('#__jfusion')
				->where('original_name IS NULL')
				->where('name LIKE ' . $db->quote($name));

			$db->setQuery($query);
			$record = $db->loadResult();

			$query = $db->getQuery(true)
				->select('id')
				->from('#__jfusion')
				->where('name = ' . $db->quote($new_name));

			$db->setQuery($query);
			$exsist = $db->loadResult();
			if ($exsist) {
				throw new RuntimeException($new_name . ' ' . Text::_('ALREADY_IN_USE'));
			} else if ($record) {
				$JFusionPlugin = Factory::getAdmin($name);
				if ($JFusionPlugin->multiInstance()) {
					$db = Factory::getDBO();
					if (!$update) {
						//add the new entry in the JFusion plugin table
						$query = $db->getQuery(true)
							->select('*')
							->from('#__jfusion')
							->where('name = ' . $db->quote($name));

						$db->setQuery($query);
						$plugin_entry = $db->loadObject();
						$plugin_entry->name = $new_name;
						$plugin_entry->id = null;
						//only change the original name if this is not a copy itself
						if (empty($plugin_entry->original_name)) {
							$plugin_entry->original_name = $name;
						}
						$db->insertObject('#__jfusion', $plugin_entry, 'id');
					}
					$result['message'] = $new_name . ': ' . Text::_('PLUGIN') . ' ' . $name . ' ' . Text::_('COPY') . ' ' . Text::_('SUCCESS');
					$result['status'] = true;
				} else {
					throw new RuntimeException(Text::_('CANT_COPY'));
				}
			} else {
				throw new RuntimeException(Text::_('INVALID_SELECTED'));
			}
		} else {
			throw new RuntimeException(Text::_('NONE_SELECTED'));
		}
		return $result;
	}
876057
public function add($element, $dependencies = array())
    {
        // Add
        $this->elements[$element] = (object)array(
            'id' => $element,
            'dependencies' => (array)$dependencies,
            'visited' => false
        );
    }
646682
protected function formatAttributes(array $attributes, $lineno, $name)
    {
        try {
            $processor = new Processor();

            return $processor->process($this->getAttributeNodeConfig(), [$attributes]);
        } catch (\Exception $e) {
            throw new SyntaxError($this->getFormattedMessageException($e), $lineno, new Source('', $name));
        }
    }
1097175
public function add($name, $source = null, $dependencies = array(), $attributes = array())
    {
        if(!is_array($name)) {
            if(!isset($source)) throw new \ErrorException("Missing argument 2 for Facuz\Theme\AssetContainer::add()", 1);
            
            return $this->added($name, $source, $dependencies, $attributes);
        }

        foreach ($name as $array) {
            if(count($array) < 2) throw new \ErrorException("Missing value 2 of the array for Facuz\Theme\AssetContainer::add()", 1);
            $container = $array[0];
            $source = $array[1]; 
            $dependencies = isset($array[2]) ? $array[2] : [];
            $attributes = isset($array[3]) ? $array[3] : [];

            $this->add($container, $source, $dependencies, $attributes);
        }

        $this->usePath(false);
    }
24773
public function addDependency(DependencyNode $node, DependencyNode $dependsOn)
    {
        if (!$this->dependencies->contains($node)) {
            $this->addNode($node);
        }
        if (!$this->dependencies->contains($dependsOn)) {
            $this->addNode($dependsOn);
        }

        if (!$this->arrayObjectContains($dependsOn, $this->dependencies[$node])) {
            $this->dependencies[$node]->append($dependsOn);
        }

        $node->dependsOn($dependsOn);
    }
46370
public function style($name, $source, $dependencies = [], $attributes = [], $replaces = [])
    {
        if (!array_key_exists('media', $attributes)) {
            $attributes['media'] = 'all';
        }

        $this->register('style', $name, $source, $dependencies, $attributes, $replaces);

        return $this;
    }
623806
public static function prepare_for_javascript($dependencies) {
        $result = [];
        foreach ($dependencies as $d) {
            if (!isset($result[$d->dependenton])) {
                $result[$d->dependenton] = [];
            }
            if (!isset($result[$d->dependenton][$d->condition])) {
                $result[$d->dependenton][$d->condition] = [];
            }
            if (!isset($result[$d->dependenton][$d->condition][$d->value])) {
                $result[$d->dependenton][$d->condition][$d->value] = [];
            }
            $result[$d->dependenton][$d->condition][$d->value][] = $d->settingname;
        }
        return $result;
    }
510921
public function add($name, $label = '', array $attributes = array(), array $rules = array())
	{
		return $this->fieldset()->add($name, $label, $attributes, $rules);
	}
343901
public function setSource($name, $href = null)
    {
        $this->source = new Element('cite', 'source');

        if (isset($href)) {
            $this->source->childNodes->push(new Link($name, $href));
        } else {
            $this->source->textContent->push($name);
        }

        return $this;
    }
437022
public function style($name, $source, $dependencies = array(), $attributes = array())
    {
        if ( ! array_key_exists('media', $attributes))
        {
            $attributes['media'] = 'all';
        }

        // Prepend path to theme.
        if ($this->isUsePath())
        {
            $source = $this->evaluatePath($this->getCurrentPath().$source);

            // Reset using path.
            $this->usePath(false);
        }

        $this->register('style', $name, $source, $dependencies, $attributes);

        return $this;
    }
251311
public function addFilter($name, $attributes = array())
    {
        // name is "filtername:method:alias".
        $names = explode(':', $name);
        $filter = array_shift($names);
        $method = array_shift($names);
        $alias = array_shift($names);
        if (! $alias) $alias = $filter;
        if (! is_array($attributes)) $attributes = [];

        // method miss match, when return.
        if ($method && strtoupper($method) !== $this->Request->getMethod()) return;

        // register.
        if (isset($this->filters[$alias])) {
            $this->filters[$alias]['attributes'] = $this->arrayUtil->merge($this->filters[$alias]['attributes'], $attributes);
        } else {
            $this->filter_names[] = $alias;
            $this->filters[$alias] = array('name' => $filter, 'attributes' => (array)$attributes);
        }

        // if action filter.
        if (strtolower($filter) === 'action') {
            $this->has_action_filter = true;
        }
    }
1281358
public static function addScript(string $name, array $options = [])
    {
        if (! in_array($name, self::getScripts()))
            self::$scripts[] = $name;
        self::setOptions($name, $options);
    }