‪TYPO3CMS  9.5
TYPO3\CMS\Extbase\Reflection\DocCommentParser Class Reference

Public Member Functions

 __construct ($useIgnoredTags=false)
 
 parseDocComment ($docComment)
 
array getTagsValues ()
 
array getTagValues ($tagName)
 
bool isTaggedWith ($tagName)
 
string getDescription ()
 

Protected Member Functions

 parseTag ($line)
 

Protected Attributes

string $description = ''
 
array $tags = array( )
 

Static Protected Attributes

static array $ignoredTags = array( 'package', 'subpackage', 'license', 'copyright', 'author', 'version', 'const' )
 

Private Attributes

bool $useIgnoredTags
 

Detailed Description

A little parser which creates tag objects from doc comments

only to be used within Extbase, not part of TYPO3 Core API.

Definition at line 21 of file DocCommentParser.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Extbase\Reflection\DocCommentParser::__construct (   $useIgnoredTags = false)
Parameters
bool$useIgnoredTags

Definition at line 42 of file DocCommentParser.php.

References TYPO3\CMS\Extbase\Reflection\DocCommentParser\$useIgnoredTags.

Member Function Documentation

◆ getDescription()

string TYPO3\CMS\Extbase\Reflection\DocCommentParser::getDescription ( )

Returns the description which has been previously parsed

Returns
‪string The description which has been parsed

Definition at line 112 of file DocCommentParser.php.

References TYPO3\CMS\Extbase\Reflection\DocCommentParser\$description.

◆ getTagsValues()

array TYPO3\CMS\Extbase\Reflection\DocCommentParser::getTagsValues ( )

Returns the tags which have been previously parsed

Returns
‪array Array of tag names and their (multiple) values

Definition at line 74 of file DocCommentParser.php.

References TYPO3\CMS\Extbase\Reflection\DocCommentParser\$tags.

◆ getTagValues()

array TYPO3\CMS\Extbase\Reflection\DocCommentParser::getTagValues (   $tagName)

Returns the values of the specified tag. The doc comment must be parsed with parseDocComment() before tags are available.

Parameters
string$tagName‪The tag name to retrieve the values for
Exceptions

Definition at line 88 of file DocCommentParser.php.

References TYPO3\CMS\Extbase\Reflection\DocCommentParser\isTaggedWith().

◆ isTaggedWith()

bool TYPO3\CMS\Extbase\Reflection\DocCommentParser::isTaggedWith (   $tagName)

Checks if a tag with the given name exists

Parameters
string$tagName‪The tag name to check for
Returns
‪bool TRUE the tag exists, otherwise FALSE

Definition at line 102 of file DocCommentParser.php.

Referenced by TYPO3\CMS\Extbase\Reflection\DocCommentParser\getTagValues().

◆ parseDocComment()

TYPO3\CMS\Extbase\Reflection\DocCommentParser::parseDocComment (   $docComment)

Parses the given doc comment and saves the result (description and tags) in the parser's object. They can be retrieved by the getTags() getTagValues() and getDescription() methods.

Parameters
string$docComment‪A doc comment as returned by the reflection getDocComment() method

Definition at line 54 of file DocCommentParser.php.

References TYPO3\CMS\Extbase\Reflection\DocCommentParser\parseTag().

◆ parseTag()

TYPO3\CMS\Extbase\Reflection\DocCommentParser::parseTag (   $line)
protected

Parses a line of a doc comment for a tag and its value. The result is stored in the interal tags array.

Parameters
string$line‪A line of a doc comment which starts with an -sign

Definition at line 123 of file DocCommentParser.php.

Referenced by TYPO3\CMS\Extbase\Reflection\DocCommentParser\parseDocComment().

Member Data Documentation

◆ $description

string TYPO3\CMS\Extbase\Reflection\DocCommentParser::$description = ''
protected

The description as found in the doc comment

Definition at line 29 of file DocCommentParser.php.

Referenced by TYPO3\CMS\Extbase\Reflection\DocCommentParser\getDescription().

◆ $ignoredTags

array TYPO3\CMS\Extbase\Reflection\DocCommentParser::$ignoredTags = array( 'package', 'subpackage', 'license', 'copyright', 'author', 'version', 'const' )
staticprotected

Definition at line 25 of file DocCommentParser.php.

◆ $tags

array TYPO3\CMS\Extbase\Reflection\DocCommentParser::$tags = array( )
protected

An array of tag names and their values (multiple values are possible)

Definition at line 33 of file DocCommentParser.php.

Referenced by TYPO3\CMS\Extbase\Reflection\DocCommentParser\getTagsValues().

◆ $useIgnoredTags

bool TYPO3\CMS\Extbase\Reflection\DocCommentParser::$useIgnoredTags
private