src/Mpociot/Reflection/DocBlock/Tag.php
final public static function createInstance(
        $tag_line,
        DocBlock $docblock = null,
        Location $location = null
    ) {
        if (!preg_match(
            '/^@(' . self::REGEX_TAGNAME . ')(?:\s*([^\s].*)|$)?/us',
            $tag_line,
            $matches
        )) {
            throw new \InvalidArgumentException(
                'Invalid tag_line detected: ' . $tag_line
            );
        }

        $handler = __CLASS__;
        if (isset(self::$tagHandlerMappings[$matches[1]])) {
            $handler = self::$tagHandlerMappings[$matches[1]];
        } elseif (isset($docblock)) {
            $tagName = (string)new Type\Collection(
                array($matches[1]),
                $docblock->getContext()
            );

            if (isset(self::$tagHandlerMappings[$tagName])) {
                $handler = self::$tagHandlerMappings[$tagName];
            }
        }

        return new $handler(
            $matches[1],
            isset($matches[2]) ? $matches[2] : '',
            $docblock,
            $location
        );
    }
final public static function createInstance(
        $tag_line,
        DocBlock $docblock = null,
        Location $location = null
    ) {
        if (!preg_match(
            '/^@(' . self::REGEX_TAGNAME . ')(?:\s*([^\s].*)|$)?/us',
            $tag_line,
            $matches
        )) {
            throw new \InvalidArgumentException(
                'Invalid tag_line detected: ' . $tag_line
            );
        }

        $handler = __CLASS__;
        if (isset(self::$tagHandlerMappings[$matches[1]])) {
            $handler = self::$tagHandlerMappings[$matches[1]];
        } elseif (isset($docblock)) {
            $tagName = (string)new Type\Collection(
                array($matches[1]),
                $docblock->getContext()
            );

            if (isset(self::$tagHandlerMappings[$tagName])) {
                $handler = self::$tagHandlerMappings[$tagName];
            }
        }

        return new $handler(
            $matches[1],
            isset($matches[2]) ? $matches[2] : '',
            $docblock,
            $location
        );
    }
final public static function createInstance ( $ tag_line , DocBlock $ docblock = null , Location $ location = null ) { if ( ! preg_match ( '/^@(' . self :: REGEX_TAGNAME . ')(?:\s*([^\s].*)|$)?/us' , $ tag_line , $ matches ) ) { throw new \ InvalidArgumentException ( 'Invalid tag_line detected: ' . $ tag_line ) ; } $ handler = __CLASS__ ; if ( isset ( self :: $ tagHandlerMappings [ $ matches [ 1 ] ] ) ) { $ handler = self :: $ tagHandlerMappings [ $ matches [ 1 ] ] ; } elseif ( isset ( $ docblock ) ) { $ tagName = ( string ) new Type \ Collection ( array ( $ matches [ 1 ] ) , $ docblock -> getContext ( ) ) ; if ( isset ( self :: $ tagHandlerMappings [ $ tagName ] ) ) { $ handler = self :: $ tagHandlerMappings [ $ tagName ] ; } } return new $ handler ( $ matches [ 1 ] , isset ( $ matches [ 2 ] ) ? $ matches [ 2 ] : '' , $ docblock , $ location ) ; }
Factory method responsible for instantiating the correct sub type.

@param string   $tag_line The text for this tag, including description.
@param DocBlock $docblock The DocBlock which this tag belongs to.
@param Location $location Location of the tag.

@throws \InvalidArgumentException if an invalid tag line was presented.

@return static A new tag object.
Factory method responsible for instantiating the correct sub type .