Test whether given start tag is immediately followed by a closing tag

@param  Tag  $tag Start tag
@return bool
426985
protected function isFollowedByClosingTag(Tag $tag)
	{
		return (empty($this->tagStack)) ? false : end($this->tagStack)->canClose($tag);
	}
503684
public function hasTag($tag)
    {
        if ($this->isTopTag($tag)) {
            return true;
        }

        return isset($this->tags[$tag]) && is_array($this->tags[$tag]);
    }
1361429
public function removeTag($tag)
    {
        if ($this->started !== true) {
            throw new Exception\SessionNotStartedException('Tried to tag a session which has not been started yet.', 1355150140);
        }
        $index = array_search($tag, $this->tags);
        if ($index !== false) {
            unset($this->tags[$index]);
        }
    }
1219145
protected function requireAncestor(Tag $tag)
	{
		$tagName   = $tag->getName();
		$tagConfig = $this->tagsConfig[$tagName];

		if (isset($tagConfig['rules']['requireAncestor']))
		{
			foreach ($tagConfig['rules']['requireAncestor'] as $ancestorName)
			{
				if (!empty($this->cntOpen[$ancestorName]))
				{
					return false;
				}
			}

			$this->logger->err('Tag requires an ancestor', [
				'requireAncestor' => implode(',', $tagConfig['rules']['requireAncestor']),
				'tag'             => $tag
			]);

			return true;
		}

		return false;
	}
1283973
public static function isAction($tag)
    {
        $that = self::getInstance(self::$id);

        return isset($that->callbacks[$tag]);
    }
796325
public function begin_tag($tag, $attributes = null) {
        // TODO: chek the tag name is valid
        $pre = $this->level ? "\n" . str_repeat(' ', $this->level * 2) : ''; // Indent
        $tag = $this->casefolding ? strtoupper($tag) : $tag; // Follow casefolding
        $end = $this->nullcontent ? ' /' : ''; // Tag without content, close it

        // Build attributes output
        $attrstring = '';
        if (!empty($attributes) && is_array($attributes)) {
            // TODO: check the attr name is valid
            foreach ($attributes as $name => $value) {
                $name = $this->casefolding ? strtoupper($name) : $name; // Follow casefolding
                $attrstring .= ' ' . $name . '="'.
                    $this->xml_safe_attr_content($value) . '"';
            }
        }

        // Optional xml schema definition (level 0 only)
        $schemastring = '';
        if ($this->level == 0 && !empty($this->xmlschema)) {
            $schemastring .= "\n    " . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' .
                             "\n    " . 'xsi:noNamespaceSchemaLocation="' . $this->xml_safe_attr_content($this->xmlschema) . '"';
        }

        // Send to xml_output
        $this->write($pre . '<' . $tag . $attrstring . $schemastring . $end . '>');

        // Acumulate the tag and inc level
        if (!$this->nullcontent) {
            array_push($this->opentags, $tag);
            $this->level++;
        }
        $this->lastwastext = false;
    }
561632
private function hasOnlyTags(string $html): bool
    {
        $html = preg_replace('/<[^>]*>/isu', '', $html);
        $html = str_replace('&nbsp;', '', $html);
        $html = trim($html);

        return strlen($html) === 0;
    }
420932
public function startTag()
	{
		if ($this->name) {
			return '<' . $this->name . $this->attributes() . (static::$xhtml && $this->isEmpty ? ' />' : '>');

		} else {
			return '';
		}
	}
471687
protected function createChild(Tag $tag)
	{
		$tagConfig = $this->tagsConfig[$tag->getName()];
		if (isset($tagConfig['rules']['createChild']))
		{
			$priority = -1000;
			$tagPos   = $this->pos + strspn($this->text, " \n\r\t", $this->pos);
			foreach ($tagConfig['rules']['createChild'] as $tagName)
			{
				$this->addStartTag($tagName, $tagPos, 0, ++$priority);
			}
		}
	}
1124400
private function tag_has_default(string $tag){
    return in_array('default', array_values(
      \is_array($this->tags[$tag]) ?
        $this->tags[$tag] :
        $this->tags[$this->tags[$tag]]
    ));
  }
1224656
private function tag_has_type(string $tag){
    return in_array('type', array_values(
      \is_array($this->tags[$tag]) ?
        $this->tags[$tag] :
        $this->tags[$this->tags[$tag]]
    ));
  }
876891
public function isVoidElement($tag = null)
    {
        if (null === $tag) {
            $tag = $this->getTag();
        }

        return in_array($tag, $this->voidElements);
    }
132501
private function isLabelableNode( Tag $tag ) {
		$labelableTags = [ 'button', 'meter', 'output', 'progress', 'select', 'textarea' ];
		$tagName = strtolower( $tag->getTag() );

		if ( $tagName === 'input' && $tag->getAttribute( 'type' ) !== 'hidden' ) {
			return true;
		}
		if ( in_array( $tagName, $labelableTags, true ) ) {
			return true;
		}
		return false;
	}
511264
def tag_start(self, tag, attrs=None):
        
        """
        return '<%s %s>' % (tag, self.build_attr(attrs)) if attrs else '<%s>' % tag
512979
protected function isMatching()/*# : bool */
    {
        if (empty($this->tags)) {
            return true;
        } else {
            return $this->getContainer()->hasTag($this->tags);
        }
    }
381794
private static function checkExp($tag)
    {
        return (false !== strpos($tag, ',')) || (false !== strpos($tag, '-')) || (false !== strpos($tag, '/'));
    }
827176
protected function start($tag, $attr = array())
    {
        return $this->generator->generateFromToken(
            new HTMLPurifier_Token_Start($tag, $attr ? $attr : array())
        );
    }