Insert given tag in the tag stack

@param  Tag  $tag
@return void
434969
protected function insertTag(Tag $tag)
	{
		if (!$this->tagStackIsSorted)
		{
			$this->tagStack[] = $tag;
		}
		else
		{
			// Scan the stack and copy every tag to the next slot until we find the correct index
			$i = count($this->tagStack);
			while ($i > 0 && self::compareTags($this->tagStack[$i - 1], $tag) > 0)
			{
				$this->tagStack[$i] = $this->tagStack[$i - 1];
				--$i;
			}
			$this->tagStack[$i] = $tag;
		}
	}
1155178
public function incrementCount($tag, $count)
	{
		if($count <= 0) { return; }

		$tag->count = $tag->count + $count;
		$tag->save();
	}
1286890
protected function outputBrTag(Tag $tag)
	{
		$this->outputText($tag->getPos(), 0, false);
		$this->output .= '<br/>';
	}
852117
public function add($tag)
    {
        if (!$tag instanceof TagInterface) {
            throw new \InvalidArgumentException('This tag is not allowed');
        }
        if ($this->isUniqueTag($tag->getName())) {
            $this->removeByName($tag->getName());
        }

        return parent::add($tag);
    }
108725
public static function remove(Tag &$Tag)
    {
        if (Config::get('store') == 'global' && isset(self::$_tagStore[$Tag->ID])) {
            unset(self::$_tagStore[$Tag->ID]);
        } elseif (Config::get('store') == 'internal'
            && isset(Config::getHTMLInstance()->tagStore[$Tag->ID])
        ) {
            unset(Config::getHTMLInstance()->tagStore[$Tag->ID]);
        }
    }
905359
public function addTag(Tag $tag)
    {
        // Add tag if not existing
        if (!$this->hasTag($tag)) {
            $this->tags[$tag->getTag()] = $tag;
        }

        // Increment counter if no override in the Tag entity
        if ($tag->getCounter() === null) {
            $tag->incCounter();
        }

        // Store the max counter
        if ($tag->getCounter() > $this->max) {
            $this->max = $tag->getCounter();
        }

        return $this;
    }
501571
static public function add($tag,$name) {
        if(!isset(self::$tags[$tag])){
            self::$tags[$tag]   =   array();
        }
        if(is_array($name)){
            self::$tags[$tag]   =   array_merge(self::$tags[$tag],$name);
        }else{
            self::$tags[$tag][] =   $name;
        }
    }
1157601
public function add_tag($tag, $message = null) {
		if ($message === null) {
			$message = $tag;
		}
		return $this->run("tag -a $tag -m " . escapeshellarg($message));
	}
38696
public function onReplaceInsertTags(string $tag)
    {
        $elements = \explode('::', $tag);
        $key = \strtolower(\array_shift($elements));

        if ('tag' === $key) {
            return $this->replaceInsertTag($elements);
        }

        return false;
    }
8909
public function tag_add($tag, $key)
    {
        if ($this->stopwatch) {
            $e = $this->getStopwatchEvent('tag_add');
        }

        $result = parent::tag_add($tag, $key);

        if ($this->stopwatch) {
            $e->stop();
        }

        return $result;
    }
503684
public function hasTag($tag)
    {
        if ($this->isTopTag($tag)) {
            return true;
        }

        return isset($this->tags[$tag]) && is_array($this->tags[$tag]);
    }
1373247
public function removeTag(Tag $tag)
    {
        if ($this->tags->contains($tag)) {
            $this->tags->removeElement($tag);
            return true;
        }
        return false;
    }
1307644
private function record_tag($tag)
    {
        if (isset($this->tags[$tag . 'count'])) { //check for the existence of this tag type
            $this->tags[$tag . 'count']++;
            $this->tags[$tag . $this->tags[$tag . 'count']] = $this->indent_level; //and record the present indent level
        } else { //otherwise initialize this tag type
            $this->tags[$tag . 'count'] = 1;
            $this->tags[$tag . $this->tags[$tag . 'count']] = $this->indent_level; //and record the present indent level
        }
        $this->tags[$tag . $this->tags[$tag . 'count'] . 'parent'] = $this->tags['parent']; //set the parent (i.e. in the case of a div this.tags.div1parent)
        $this->tags['parent'] = $tag . $this->tags[$tag . 'count']; //and make this the current parent (i.e. in the case of a div 'div1')
    }
842977
public function cascadeInvalidationTo(Tag $tag)
	{
		$this->cascade[] = $tag;

		// If this tag is already invalid, cascade it now
		if ($this->invalid)
		{
			$tag->invalidate();
		}
	}
230241
public void addTag(String tag) {
   		if (insertTagDb(tag)) {
   			this.tags.add(tag);
   			notifyEvent(HistoryReferenceEventPublisher.EVENT_TAG_ADDED);
   		}
   	}
682624
protected function outputIgnoreTag(Tag $tag)
	{
		$tagPos = $tag->getPos();
		$tagLen = $tag->getLen();

		// Capture the text to ignore
		$ignoreText = substr($this->text, $tagPos, $tagLen);

		// Catch up with the tag's position then output the tag
		$this->outputText($tagPos, 0, false);
		$this->output .= '<i>' . htmlspecialchars($ignoreText, ENT_NOQUOTES, 'UTF-8') . '</i>';
		$this->isRich = true;

		// Move the cursor past this tag
		$this->pos = $tagPos + $tagLen;
	}
1308330
public function endElement($tag) {
		$this->level--;
		if (!($this->level == 1 && $tag == 'item')) return;
		$this->items[] = $this->currentItem;
		$this->currentItem = null;
	}