Creates a Tag object given the contents of a tag.
This Factory is capable of determining the appropriate class for a tag and instantiate it using its create
factory method. The create
factory method of a Tag can have a variable number of arguments; this way you can
pass the dependencies that you need to construct a tag object.
Important: each parameter in addition to the body variable for the
create
method must default to null, otherwise
it violates the constraint with the interface; it is recommended to use the {@see \Assert::notNull()} method to
verify that a dependency is actually passed.
This Factory also features a Service Locator component that is used to pass the right dependencies to the
create
method of a tag; each dependency should be registered as a service or as a parameter.
When you want to use a Tag of your own with custom handling you need to call the registerTagHandler
method, pass
the name of the tag and a Fully Qualified Class Name pointing to a class that implements the Tag interface.
Constants |
public phpDocumentor PCRE regular expression matching a tag name. |
Methods |
public __construct(phpDocumentor Initialize this tag factory with the means to resolve an FQSEN and optionally a list of tag handlers. If no tag handlers are provided than the default list in the {@see \self::$tagHandlerMappings} property
|
public addParameter(string $name, $value) : void
|
public addService(object $service, ?string $alias = NULL) : void |
public create(string $tagLine, ?phpDocumentor |
public registerTagHandler(string $tagName, string $handler) : void |
Properties |
private $annotationMappings = []
|
private $fqsenResolver = NULL
|
private $serviceLocator = []
|
private $tagHandlerMappings = ['author' => 'phpDocumentor\Reflection\DocBlock\Tags\Author', 'covers' => 'phpDocumentor\Reflection\DocBlock\Tags\Covers', 'deprecated' => 'phpDocumentor\Reflection\DocBlock\Tags\Deprecated', 'link' => 'phpDocumentor\Reflection\DocBlock\Tags\Link', 'method' => 'phpDocumentor\Reflection\DocBlock\Tags\Method', 'param' => 'phpDocumentor\Reflection\DocBlock\Tags\Param', 'property-read' => 'phpDocumentor\Reflection\DocBlock\Tags\PropertyRead', 'property' => 'phpDocumentor\Reflection\DocBlock\Tags\Property', 'property-write' => 'phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite', 'return' => 'phpDocumentor\Reflection\DocBlock\Tags\Return_', 'see' => 'phpDocumentor\Reflection\DocBlock\Tags\See', 'since' => 'phpDocumentor\Reflection\DocBlock\Tags\Since', 'source' => 'phpDocumentor\Reflection\DocBlock\Tags\Source', 'throw' => 'phpDocumentor\Reflection\DocBlock\Tags\Throws', 'throws' => 'phpDocumentor\Reflection\DocBlock\Tags\Throws', 'uses' => 'phpDocumentor\Reflection\DocBlock\Tags\Uses', 'var' => 'phpDocumentor\Reflection\DocBlock\Tags\Var_', 'version' => 'phpDocumentor\Reflection\DocBlock\Tags\Version']
|
private $tagHandlerParameterCache = []
|
Methods |
private createTag(string $body, string $name, phpDocumentor Creates a new tag object with the given name and body or returns null if the tag name was recognized but the |
private extractTagParts(string $tagLine) : array Extracts all components for a tag.
|
private fetchParametersForHandlerFactoryMethod(string $handlerClassName) : array Retrieves a series of ReflectionParameter objects for the static 'create' method of the given
|
private findHandlerClassName(string $tagName, phpDocumentor Determines the Fully Qualified Class Name of the Factory or Tag (containing a Factory Method
|
private getArgumentsForParametersFromWiring(array $parameters, array $locator) : array Retrieves the arguments that need to be passed to the Factory Method with the given Parameters.
|
private getServiceLocatorWithDynamicParameters(phpDocumentor Returns a copy of this class' Service Locator with added dynamic parameters,
|
private isAnnotation(string $tagContent) : bool Returns whether the given tag belongs to an annotation.
|