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.
Ejemplo n.º 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);
 }
Ejemplo n.º 2
0
 /**
  * Registers all tags handlers.
  */
 public static function registerTagHandlers()
 {
     static $isRegistered;
     if (!$isRegistered) {
         $mapping = ['query' => '\\pahanini\\restdoc\\tags\\QueryTag', 'field' => '\\phpDocumentor\\Reflection\\DocBlock\\Tag\\ParamTag', 'link' => '\\phpDocumentor\\Reflection\\DocBlock\\Tag\\ParamTag', 'label' => '\\phpDocumentor\\Reflection\\DocBlock\\Tag', 'extraField' => '\\phpDocumentor\\Reflection\\DocBlock\\Tag\\ParamTag', 'extraLink' => '\\phpDocumentor\\Reflection\\DocBlock\\Tag\\ParamTag'];
         foreach ($mapping as $suffix => $class) {
             $tagName = Doc::TAG_PREFIX . $suffix;
             Tag::registerTagHandler($tagName, $class);
         }
     }
 }
 /**
  * Perform post-registration booting of services.
  *
  * @return void
  */
 public function boot()
 {
     // Registering custom tags
     Tag::registerTagHandler('apiParam', '\\phpDocumentor\\Reflection\\DocBlock\\Tag\\ParamTag');
     // Set router
     RouteResolver::setRouter(app()->make('router'));
     // use this if your package needs a config file
     // $this->publishes([
     //         __DIR__.'/config/config.php' => config_path('skeleton.php'),
     // ]);
     // use the vendor configuration file as fallback
     // $this->mergeConfigFrom(
     //     __DIR__.'/config/config.php', 'skeleton'
     // );
 }
Ejemplo n.º 4
0
 /**
  * @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler
  *
  * @return void
  */
 public function testIncompatibleTagHandlerRegistration()
 {
     $currentHandler = __NAMESPACE__ . '\\Tag\\VarTag';
     $tagPreReg = Tag::createInstance('@var mixed');
     $this->assertInstanceOf($currentHandler, $tagPreReg);
     $this->assertInstanceOf(__NAMESPACE__ . '\\Tag', $tagPreReg);
     $this->assertFalse(Tag::registerTagHandler('var', __NAMESPACE__ . '\\TagTest'));
     $tagPostReg = Tag::createInstance('@var mixed');
     $this->assertInstanceOf($currentHandler, $tagPostReg);
     $this->assertInstanceOf(__NAMESPACE__ . '\\Tag', $tagPostReg);
 }