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\Reflection\DocBlock\StandardTagFactory
::REGEX_TAGNAME
=
'[\w\-\_\\:]+'
PCRE regular expression matching a tag name. |
Methods |
public
__construct
(
phpDocumentor\Reflection\FqsenResolver
$fqsenResolver
,
?
array
$tagHandlers
=
NULL
) 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\Reflection\Types\Context $context = NULL ) : phpDocumentor\Reflection\DocBlock\Tag |
public registerTagHandler ( string $tagName , string $handler ) : void |
Properties |
private
$annotationMappings
|
private
$fqsenResolver
|
private
$serviceLocator
|
private
$tagHandlerMappings
|
private
$tagHandlerParameterCache
|
Methods |
private
createTag
(
string
$body
,
string
$name
,
phpDocumentor\Reflection\Types\Context
$context
) :
phpDocumentor\Reflection\DocBlock\Tag
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\Reflection\Types\Context
$context
) :
string
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\Reflection\Types\Context
$context
,
string
$tagName
,
string
$tagBody
) :
array
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.
|