Insert a script to script list

@since   1.1
@param   int $index Index of insert position
@param   string $type Type of script (file, library or script)
@param   string $hrefOrScript Path of script from /public or script content.
@return  $this
194844
private function insert($index, $type, $hrefOrScript)
    {
        self::$scriptList->insert($index, array($type, $hrefOrScript));
        return $this;
    }
1244749
protected function indexCommand($type, $columns, $index, $algorithm = null)
    {
        $columns = (array) $columns;

        // If no name was specified for this index, we will create one using a basic
        // convention of the table name, followed by the columns, followed by an
        // index type, such as primary or index, which makes the index unique.
        $index = $index ?: $this->createIndexName($type, $columns);

        return $this->addCommand(
            $type, compact('index', 'columns', 'algorithm')
        );
    }
280497
def insert(cls, index, interceptor):
        
        cls._check(interceptor)
        cls._interceptors.insert(index, interceptor)
716747
public StrBuilder insert(int index, char[] src) {
		if (ArrayUtil.isEmpty(src)) {
			return this;
		}
		return insert(index, src, 0, src.length);
	}
325163
public JSPStrBuffer insert(int index, char[] chars, int start, int length) {
		sb.insert(index, chars, start, length);
		return this;
	}
244721
public function remove(string $type, int $index)
    {
        if (isset($this->values[$type][$index])) {
            unset($this->values[$type][$index]);

            --$this->valuesCount;
        }

        return $this;
    }
1261320
public function showScript($parent_name, $child_name, $edit = '', $index = FALSE)
    {
        $script = '';
        $script .= '$(document).ready(function() {';
        $script .= '$(window).load(function() {';
        $script .= '$(\'select[name="' . $child_name . '"] option[value != "select_' . $child_name . '"]\').prop(\'disabled\', true);';
        if ($edit != '') {
            $script .= '$(\'select[name="' . $child_name . '"] option[value = "' . $edit . '"]\').prop(\'disabled\', false);';
        }
        if ($index === TRUE) {
            $script .= 'var id_telco = $(\'[name="' . $parent_name . '"]\').val();';
            $script .= '$(\'select[name="' . $child_name . '"] option[data-' . $parent_name . '="\' + id_telco + \'"]\').prop(\'disabled\', false);';
        }
        $script .= '$(\'[name="' . $parent_name . '"]\').change(function(){';
        $script .= 'var id_telco = $(\'[name="' . $parent_name . '"]\').val();';
        $script .= 'if (id_telco == \'select_' . $parent_name . '\')';
        $script .= '{';
        $script .= ' $(\'select[name="' . $child_name . '"] option[value != "select_' . $child_name . '"]\').prop(\'disabled\', true);';
        $script .= '}';
        $script .= 'else';
        $script .= '{';
        $script .= '$(\'select[name="' . $child_name . '"] option[value != "select_' . $child_name . '"]\').prop(\'disabled\', true);';
        $script .= '$(\'select[name="' . $child_name . '"] option[data-' . $parent_name . '="\' + id_telco + \'"]\').prop(\'disabled\', false);';
        $script .= '}';
        $script .= '$(\'select[name="' . $child_name . '"]\').select2();';
        $script .= '$(\'select[name="' . $child_name . '"]\').val(\'select_' . $child_name . '\').trigger(\'change\');';
        $script .= '});';
        $script .= '$(\'select[name="' . $child_name . '"]\').select2();';
        $script .= '});';
        $script .= '});';

        return $script;
    }
37346
public function add($element, $index = null)
    {
        if (null === $index || '' === $index) {
            $this->elements[] = $element;
        } else {
            $this->elements[$index] = $element;
        }

        return $this;
    }
1215430
public function removeDocuments(array $ids, $index, $type = '')
    {
        if (empty($type)) {
            $type = $this->typeName;
        }

        $client = $this->getClient();
        $index = $client->getIndex($index);

        $client->deleteIds($ids, $index, $type);

        // Refresh index because bulk deletions are slow
        $index->refresh();
    }
732039
private function setLink($type, $title, $href)
    {
        $this->links[$type] = [
            'rel' => $type,
            'title' => $title,
            'href' => $href
        ];
    }
973858
public function create($index, $type, $document)
    {
        $request = $this->createRequestInstance(self::CREATE_DOCUMENT, $index, $type);
        $request->setBody($document);

        return $this->client->send($request);
    }
299594
public function create($type, Closure $callback, $index = null)
    {
        if (!is_string($type)) {
            throw new InvalidArgumentException('type should be a string');
        }

        if ($index and !is_string($index)) {
            throw new InvalidArgumentException('index should be a string');
        }

        $blueprint = $this->createBlueprint($type, $closure = null, $index);

        $blueprint->create();

        $callback($blueprint);

        $this->build($blueprint);
    }
1284448
public function prepend($href, $rel = null, $type = null, $media = null)
    {
        self::$linkList->prepend(array($href, $rel, $type, $media));
        return $this;
    }
506601
private function locateInjectionIndex(array $contents, string $type) : stdClass
    {
        $action = (object) [
            'index' => null,
            'type' => self::ACTION_NOT_FOUND,
        ];

        foreach ($contents as $index => $line) {
            if (! preg_match('/^### ' . $type . '/i', $line)) {
                continue;
            }

            $action->index = $index + 2;
            $action->type = preg_match('/^- Nothing/', $contents[$action->index])
                ? self::ACTION_REPLACE
                : self::ACTION_INJECT;
            break;
        }

        return $action;
    }
807068
public static function getErrorRoute($type, $index = 0) {

		if(false === ('-' . intval($type) == '-' . $type)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($type)), E_USER_ERROR);
		}

		if(false === ('-' . intval($index) == '-' . $index)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($index)), E_USER_ERROR);
		}

		if(true === isset(static :: $error['types'][$type][$index])) {
			return static :: $error['types'][$type][$index];
		}

		return null;
	}
760324
public function insert($index, self $str){
		
		if(!$this->offsetExists($index)){
			throw new \OutOfRangeException('$index is invalid');
		}
		
		return new static(
				$this->substring(0, $index) .
				$str->_Value .
				$this->substring($index),
			$this->_Encoding);
		
	}
477305
public function link($type = null, $index = null)
    {
        // One-time caching of link elements
        if ($this->links === null) {
            $this->cacheLinkTypeItems();
        }

        // Find the matching LinkType items
        $links = ($type === null) ? $this->links->getItems() : $this->links->getItems($type);

        // Return link item(s)
        return ($index === null) ? new ItemList($links) : $this->getLinkIndex($links, $type, $index);
    }