phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler PHP Method

registerTagHandler() final public static method

Registers a handler for tags. The class specified is autoloaded if it's not available. It must inherit from this class.
final public static registerTagHandler ( string $tag, string | null $handler ) : boolean
$tag string Name of tag to regiser a handler for. When registering a namespaced tag, the full name, along with a prefixing slash MUST be provided.
$handler string | null FQCN of handler. Specifing NULL removes the handler for the specified tag, if any.
return boolean TRUE on success, FALSE on failure.
    public static final function registerTagHandler($tag, $handler)
    {
        $tag = trim((string) $tag);
        if (null === $handler) {
            unset(self::$tagHandlerMappings[$tag]);
            return true;
        }
        if ('' !== $tag && class_exists($handler, true) && is_subclass_of($handler, __CLASS__) && !strpos($tag, '\\')) {
            self::$tagHandlerMappings[$tag] = $handler;
            return true;
        }
        return false;
    }

Usage Example

示例#1
0
 /**
  * 
  * @return \phpDocumentor\Reflection\DocBlock
  */
 protected function getDocBlock()
 {
     if (!self::$registered) {
         Tag::registerTagHandler('requiresRight', '\\oat\\tao\\model\\controllerMap\\RequiresRightTag');
         self::$registered = true;
     }
     return new DocBlock($this->method);
 }
All Usage Examples Of phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler