phpDoctor::createTag PHP Method

createTag() public method

Create a tag. This method first tries to load a Taglet for the given tag name, upon failing it then tries to load a PHPDoctor specialised tag class (e.g. classes/paramtag.php), if it still has not found a tag class it uses the standard tag class.
public createTag ( $name, $text, &$data, &$root ) : Tag
return Tag
    function &createTag($name, $text, &$data, &$root)
    {
        $class = substr($name, 1);
        if ($class) {
            $tagletFile = $this->makeAbsolutePath($this->fixPath($this->_tagletPath) . substr($name, 1) . '.php', $this->_path);
            if (is_file($tagletFile)) {
                // load taglet for this tag
                if (!class_exists($class)) {
                    require_once $tagletFile;
                }
                $tag =& new $class($text, $data, $root);
                return $tag;
            } else {
                $tagFile = $this->makeAbsolutePath('classes/' . $class . 'Tag.php', $this->_path);
                if (is_file($tagFile)) {
                    // load class for this tag
                    $class .= 'Tag';
                    if (!class_exists($class)) {
                        require_once $tagFile;
                    }
                    $tag =& new $class($text, $data, $root);
                    return $tag;
                } else {
                    // create standard tag
                    $tag =& new tag($name, $text, $root);
                    return $tag;
                }
            }
        }
    }