class BespokeDocBlockParser (View source)

Given a class and method name, parse the annotations in the DocBlock comment, and provide accessor methods for all of the elements that are needed to create an annotated Command.

Properties

protected $fqcnCache
protected $commandInfo
protected $reflection
protected $optionParamName
protected array $tagProcessors

Methods

__construct(CommandInfo $commandInfo, ReflectionMethod $reflection, $fqcnCache = null)

No description

parse()

Parse the docBlock comment for this command, and set the fields of this class with the data thereby obtained.

processGenericTag($tag)

Save any tag that we do not explicitly recognize in the 'otherAnnotations' map.

processCommandTag($tag)

Set the name of the command from a @command or @name annotation.

processAlternateDescriptionTag($tag) deprecated

The @description and @desc annotations may be used in place of the synopsis (which we call 'description').

processParamTag($tag)

Store the data from a @param annotation in our argument descriptions.

ignoredParamType($paramType)

No description

processArgumentTag($tag)

Store the data from a @arg annotation in our argument descriptions.

processOptionTag($tag)

Store the data from an @option annotation in our option descriptions.

addOptionOrArgumentTag($tag, DefaultsWithDescriptions $set, $name, $description)

No description

splitOutDefault($description)

No description

processDefaultTag($tag)

Store the data from a @default annotation in our argument or option store, as appropriate.

processUsageTag($tag)

Store the data from a @usage annotation in our example usage list.

processAliases($tag)

Process the comma-separated list of aliases

processReturnTag($tag)

Store the data from a @return annotation in our argument descriptions.

findFullyQualifiedClass($className)

No description

processDescriptionAndHelp($lines)

No description

nextLineIsNotEmpty($lines)

No description

processAllTags($tags)

No description

lastParameterName()

No description

optionParamName()

Return the name of the last parameter if it holds the options.

interpretDefaultValue($defaultValue)

No description

static 
convertListToCommaSeparated($text)

Given a list that might be 'a b c' or 'a, b, c' or 'a,b,c', convert the data into the last of these forms.

static 
removeLineBreaks($text)

Take a multiline description and convert it into a single long unbroken line.

Details

__construct(CommandInfo $commandInfo, ReflectionMethod $reflection, $fqcnCache = null)

No description

Parameters

CommandInfo $commandInfo
ReflectionMethod $reflection
$fqcnCache

parse()

Parse the docBlock comment for this command, and set the fields of this class with the data thereby obtained.

protected processGenericTag($tag)

Save any tag that we do not explicitly recognize in the 'otherAnnotations' map.

Parameters

$tag

protected processCommandTag($tag)

Set the name of the command from a @command or @name annotation.

Parameters

$tag

protected processAlternateDescriptionTag($tag) deprecated

deprecated

The @description and @desc annotations may be used in place of the synopsis (which we call 'description').

This is discouraged.

Parameters

$tag

protected processParamTag($tag)

Store the data from a @param annotation in our argument descriptions.

Parameters

$tag

protected ignoredParamType($paramType)

No description

Parameters

$paramType

protected processArgumentTag($tag)

Store the data from a @arg annotation in our argument descriptions.

Parameters

$tag

protected processOptionTag($tag)

Store the data from an @option annotation in our option descriptions.

Parameters

$tag

protected addOptionOrArgumentTag($tag, DefaultsWithDescriptions $set, $name, $description)

No description

Parameters

$tag
DefaultsWithDescriptions $set
$name
$description

protected splitOutDefault($description)

No description

Parameters

$description

protected processDefaultTag($tag)

Store the data from a @default annotation in our argument or option store, as appropriate.

Parameters

$tag

protected processUsageTag($tag)

Store the data from a @usage annotation in our example usage list.

Parameters

$tag

protected processAliases($tag)

Process the comma-separated list of aliases

Parameters

$tag

protected processReturnTag($tag)

Store the data from a @return annotation in our argument descriptions.

Parameters

$tag

protected findFullyQualifiedClass($className)

No description

Parameters

$className

protected processDescriptionAndHelp($lines)

No description

Parameters

$lines

protected nextLineIsNotEmpty($lines)

No description

Parameters

$lines

protected processAllTags($tags)

No description

Parameters

$tags

protected lastParameterName()

No description

optionParamName()

Return the name of the last parameter if it holds the options.

protected interpretDefaultValue($defaultValue)

No description

Parameters

$defaultValue

static protected convertListToCommaSeparated($text)

Given a list that might be 'a b c' or 'a, b, c' or 'a,b,c', convert the data into the last of these forms.

Parameters

$text

static protected removeLineBreaks($text)

Take a multiline description and convert it into a single long unbroken line.

Parameters

$text