get the tag object from a tag name

@param string $tagName tag name to load

@return TagInterface|null
6105
protected function getTagObject($tagName)
    {
        if (!$this->extensionsLoaded) {
            $this->loadExtensions();
        }

        if (!array_key_exists($tagName, $this->tagObjects)) {
            return null;
        }

        $tagObject = $this->tagObjects[$tagName];
        $tagObject->setParsingCssObject($this->parsingCss);
        $tagObject->setCssConverterObject($this->cssConverter);
        $tagObject->setPdfObject($this->pdf);
        if (!is_null($this->debug)) {
            $tagObject->setDebugObject($this->debug);
        }

        return $tagObject;
    }
1275663
public function getTagByClassName($className)
    {
        if (is_object($className)) $className = get_class($className);
        if (isset($this->known[$className]['tagName'])) {
            return $this->known[$className]['tagName'];
        } else {
            return null;
        }
    }
1213847
public function removeTags($tagName = null) {
		$this->tags = $this->tags->filter(function ($tag) use ($tagName) {
			return $tagName !== $tag->getTagName();
		});
	}
105286
public function getElementByTagName($tagName)
    {
        if (null === $this->treeRoot){
            return array();
        }
        $children = $this->treeRoot->getChildren();

        return $this->getElementByTagInChildren($children, $tagName);
    }
1123651
public static function get_by_id($tagcollid) {
        $tagcolls = self::get_collections();
        if (array_key_exists($tagcollid, $tagcolls)) {
            return $tagcolls[$tagcollid];
        }
        return null;
    }
413344
public function get( $name ) {

		if ( ! isset( $this->cookie[ $name ] ) ) { // Input var okay.
			return null;
		}

		return strip_tags( stripslashes( $this->cookie[ $name ] ) ); // Input var okay.
	}
633000
public function resolveTagNames($tagNames)
    {
        $resolvedTags = [];

        foreach ($tagNames as $tagName) {
            $tag = $this->findByName($tagName);
            if (null !== $tag) {
                $resolvedTags[] = $tag->getId();
            }
        }

        return $resolvedTags;
    }
817137
protected function _findFirst(int $tag)
    {
        foreach ($this->_names as $name) {
            if ($name->tag() == $tag) {
                return $name;
            }
        }
        return null;
    }
311964
private function getRegex($tagName)
    {
        $regex = '';
        if ('tag' == $tagName) {
            $begin = $this->config['tpl_begin'];
            $end   = $this->config['tpl_end'];

            if (strlen(ltrim($begin, '\\')) == 1 && strlen(ltrim($end, '\\')) == 1) {
                $regex = $begin . '((?:[\$]{1,2}[a-wA-w_]|[\:\~][\$a-wA-w_]|[+]{2}[\$][a-wA-w_]|[-]{2}[\$][a-wA-w_]|\/[\*\/])(?>[^' . $end . ']*))' . $end;
            } else {
                $regex = $begin . '((?:[\$]{1,2}[a-wA-w_]|[\:\~][\$a-wA-w_]|[+]{2}[\$][a-wA-w_]|[-]{2}[\$][a-wA-w_]|\/[\*\/])(?>(?:(?!' . $end . ').)*))' . $end;
            }
        } else {
            $begin  = $this->config['taglib_begin'];
            $end    = $this->config['taglib_end'];
            $single = strlen(ltrim($begin, '\\')) == 1 && strlen(ltrim($end, '\\')) == 1 ? true : false;

            switch ($tagName) {
                case 'block':
                    if ($single) {
                        $regex = $begin . '(?:' . $tagName . '\b(?>(?:(?!name=).)*)\bname=([\'\"])(?P<name>[\$\w\-\/\.]+)\\1(?>[^' . $end . ']*)|\/' . $tagName . ')' . $end;
                    } else {
                        $regex = $begin . '(?:' . $tagName . '\b(?>(?:(?!name=).)*)\bname=([\'\"])(?P<name>[\$\w\-\/\.]+)\\1(?>(?:(?!' . $end . ').)*)|\/' . $tagName . ')' . $end;
                    }
                    break;
                case 'literal':
                    if ($single) {
                        $regex = '(' . $begin . $tagName . '\b(?>[^' . $end . ']*)' . $end . ')';
                        $regex .= '(?:(?>[^' . $begin . ']*)(?>(?!' . $begin . '(?>' . $tagName . '\b[^' . $end . ']*|\/' . $tagName . ')' . $end . ')' . $begin . '[^' . $begin . ']*)*)';
                        $regex .= '(' . $begin . '\/' . $tagName . $end . ')';
                    } else {
                        $regex = '(' . $begin . $tagName . '\b(?>(?:(?!' . $end . ').)*)' . $end . ')';
                        $regex .= '(?:(?>(?:(?!' . $begin . ').)*)(?>(?!' . $begin . '(?>' . $tagName . '\b(?>(?:(?!' . $end . ').)*)|\/' . $tagName . ')' . $end . ')' . $begin . '(?>(?:(?!' . $begin . ').)*))*)';
                        $regex .= '(' . $begin . '\/' . $tagName . $end . ')';
                    }
                    break;
                case 'restoreliteral':
                    $regex = '<!--###literal(\d+)###-->';
                    break;
                case 'include':
                    $name = 'file';
                case 'taglib':
                case 'layout':
                case 'extend':
                    if (empty($name)) {
                        $name = 'name';
                    }
                    if ($single) {
                        $regex = $begin . $tagName . '\b(?>(?:(?!' . $name . '=).)*)\b' . $name . '=([\'\"])(?P<name>[\$\w\-\/\.\:@,\\\\]+)\\1(?>[^' . $end . ']*)' . $end;
                    } else {
                        $regex = $begin . $tagName . '\b(?>(?:(?!' . $name . '=).)*)\b' . $name . '=([\'\"])(?P<name>[\$\w\-\/\.\:@,\\\\]+)\\1(?>(?:(?!' . $end . ').)*)' . $end;
                    }
                    break;
            }
        }

        return '/' . $regex . '/is';
    }
1132575
public function getTag(string $name)
    {
        $tagFinderOutput = $this->caller
            ->execute(TagCommand::getInstance()->listTags())
            ->getOutputLines(true);

        foreach ($tagFinderOutput as $line) {
            if ($line === $name) {
                return new Tag($this, $name);
            }
        }

        return null;
    }
610573
public function getPropertiesByTagName($tagName)
    {
        if (array_key_exists($tagName, $this->tags)) {
            return $this->tags[$tagName]['properties'];
        } else {
            throw new NoSuchPropertyException($tagName);
        }
    }
1280535
private function getTagDate($tagName)
    {
        /** @var \Platformsh\Cli\Service\Git $git */
        $git = $this->getService('git');
        $date = $git->execute(['log', '-1', '--format=%aI', 'refs/tags/' . $tagName]);

        return is_string($date) ? strtotime(trim($date)) : false;
    }
950682
public function getByName($name)
    {
        return isset($this->names[$name]) ? $this->names[$name] : null;
    }
886750
public function getPhpdocType($reflection, string $tagName)
    {
        /** @var Return_[]|Throws[] $tags */
        $tags = $this->getTags($reflection, $tagName);
        $tag = array_pop($tags);
        $type = $tag ? $tag->getType() : null;

        return $this->resolve($reflection, $type);
    }
934560
public function get($name)
    {
        if (isset($this->_loaded[$name])) {
            return $this->_loaded[$name];
        }

        return null;
    }
292923
public function getMethodAnnotationsForMatchingTag($tag, $methodName = null) {
        if ($methodName) {
            return isset($this->methodAnnotations[$methodName][$tag]) ? $this->methodAnnotations[$methodName][$tag] : array();
        } else {
            $matchingAnnotations = array();
            foreach ($this->getMethodAnnotations() as $method => $methodAnnotations) {
                if (isset($methodAnnotations[$tag])) {
                    $matchingAnnotations[$method] = $methodAnnotations[$tag];
                }
            }

            return $matchingAnnotations;
        }
    }
116035
public function getByNameOrCreate($name)
    {
        if ($tag = $this->getByName($name)) {
            return $tag;
        }

        return $this->create($name);
    }