PHP_CodeSniffer
[ class tree: PHP_CodeSniffer ] [ index: PHP_CodeSniffer ] [ all elements ]
Packages:
PHP_CodeSniffer


Classes:
Generic_Sniffs_Files_LineLengthSniff
Generic_Sniffs_Methods_OpeningMethodBraceBsdAllmanSniff
Generic_Sniffs_Methods_OpeningMethodBraceKernighanRitchieSniff
Generic_Sniffs_NamingConventions_UpperCaseConstantNameSniff
Generic_Sniffs_PHP_DisallowShortOpenTagSniff
Generic_Sniffs_PHP_LowerCaseConstantSniff
Generic_Sniffs_PHP_UpperCaseConstantSniff
PEAR_Sniffs_Commenting_InlineCommentSniff
PEAR_Sniffs_ControlStructures_ControlSignatureSniff
PEAR_Sniffs_Files_IncludingFileSniff
PEAR_Sniffs_Files_LineLengthSniff
PEAR_Sniffs_Methods_FunctionCallSignatureSniff
PEAR_Sniffs_Methods_MethodCallArgumentSpacingSniff
PEAR_Sniffs_Methods_OpeningMethodBraceSniff
PEAR_Sniffs_Methods_ValidDefaultValueSniff
PEAR_Sniffs_NamingConventions_ValidClassNameSniff
PEAR_Sniffs_NamingConventions_ValidConstantNameSniff
PEAR_Sniffs_NamingConventions_ValidFunctionNameSniff
PEAR_Sniffs_PHP_ConstantSniff
PEAR_Sniffs_PHP_DisallowShortOpenTagSniff
PEAR_Sniffs_Statements_MultipleStatementSniff
PEAR_Sniffs_Whitespace_ScopeClosingBraceSniff
PEAR_Sniffs_Whitespace_ScopeIndentSniff
PHP_CodeSniffer
PHP_CodeSniffer_CommentParser_AbstractDocElement
PHP_CodeSniffer_CommentParser_AbstractParser
PHP_CodeSniffer_CommentParser_ClassCommentParser
PHP_CodeSniffer_CommentParser_CommentElement
PHP_CodeSniffer_CommentParser_FunctionCommentParser
PHP_CodeSniffer_CommentParser_MemberCommentParser
PHP_CodeSniffer_CommentParser_PairElement
PHP_CodeSniffer_CommentParser_ParameterElement
PHP_CodeSniffer_CommentParser_ParserException
PHP_CodeSniffer_CommentParser_SingleElement
PHP_CodeSniffer_Exception
PHP_CodeSniffer_File
PHP_CodeSniffer_Sniff_Exception
PHP_CodeSniffer_Standards_AbstractPatternSniff
PHP_CodeSniffer_Standards_AbstractScopeSniff
PHP_CodeSniffer_Standards_AbstractVariableSniff
PHP_CodeSniffer_Standards_IncorrectPatternException
PHP_CodeSniffer_Tokens
Files:
AbstractDocElement.php
AbstractParser.php
AbstractPatternSniff.php
AbstractScopeSniff.php
AbstractVariableSniff.php
ClassCommentParser.php
CodeSniffer.php
CommentElement.php
ConstantSniff.php
ControlSignatureSniff.php
DisallowShortOpenTagSniff.php
DisallowShortOpenTagSniff.php
DocElement.php
Exception.php
File.php
FunctionCallSignatureSniff.php
FunctionCommentParser.php
IncludingFileSniff.php
IncorrectPatternException.php
InlineCommentSniff.php
LineLengthSniff.php
LineLengthSniff.php
LowerCaseConstantSniff.php
MemberCommentParser.php
MethodCallArgumentSpacingSniff.php
MultipleStatementSniff.php
OpeningMethodBraceBsdAllmanSniff.php
OpeningMethodBraceKernighanRitchieSniff.php
OpeningMethodBraceSniff.php
PairElement.php
ParameterElement.php
ParserException.php
ScopeClosingBraceSniff.php
ScopeIndentSniff.php
SingleElement.php
Sniff.php
SniffException.php
Tokens.php
UpperCaseConstantNameSniff.php
UpperCaseConstantSniff.php
ValidClassNameSniff.php
ValidConstantNameSniff.php
ValidDefaultValueSniff.php
ValidFunctionNameSniff.php

Class: PHP_CodeSniffer_CommentParser_AbstractParser

Source Location: /PHP_CodeSniffer-0.2.0/CodeSniffer/CommentParser/AbstractParser.php


Child classes:

PHP_CodeSniffer_CommentParser_MemberCommentParser
Parses class member comments.
PHP_CodeSniffer_CommentParser_FunctionCommentParser
Parses function doc comments.
PHP_CodeSniffer_CommentParser_ClassCommentParser
Parses Class doc comments.

Inherited Variables

Inherited Methods


Class Details

[line 70]
Parses doc comments.

This abstract parser handles the following tags:

  • The short description and the long description
  • @see
  • @link
  • @deprecated
  • @since

Extending classes should implement the getAllowedTags() method to return the tags that they wish to process, ommiting the tags that this base class processes. When one of these tags in encountered, the process<tag_name> method is called on that class. For example, if a parser's getAllowedTags() method returns \@param as one of its tags, the processParam method will be called so that the parser can process such a tag.

The method is passed the tokens that comprise this tag. The tokens array includes the whitespace that exists between the tokens, as seperate tokens. It's up to the method to create a element that implements the DocElement interface, which should be returned. The AbstractDocElement class is a helper class that can be used to handle most of the parsing of the tokens into their individual sub elements. It requires that you construct it with the element previous to the element currently being processed, which can be acquired with the protected $previousElement class member of this class.

  • Author: Squiz Pty Ltd
  • Abstract:


[ Top ]


Class Variables

$comment = null

[line 78]

The comment element that appears in the doc comment.
  • Access: protected



[ Top ]

$deprecated = null

[line 112]

A list of see elements that appear in this doc comment.
  • Access: protected

Type: array(PHP_CodeSniffer_CommentParser_SingleElement)


[ Top ]

$links = array()

[line 119]

A list of see elements that appear in this doc comment.
  • Access: protected

Type: array(PHP_CodeSniffer_CommentParser_SingleElement)


[ Top ]

$previousElement = null

[line 98]

The previous doc element that was processed.

null if the current element being processed is the first element in the doc comment.

  • Access: protected



[ Top ]

$sees = array()

[line 105]

A list of see elements that appear in this doc comment.
  • Access: protected

Type: array(PHP_CodeSniffer_CommentParser_SingleElement)


[ Top ]

$since = null

[line 126]

A element to represent \@since tags.
  • Access: protected



[ Top ]

$words = array()

[line 88]

The word tokens that appear in the comment.

Whitespace tokens also appear in this stack, but are separate tokens from words.

  • Access: protected

Type: array(string)


[ Top ]



Method Detail

__construct (Constructor) [line 153]

PHP_CodeSniffer_CommentParser_AbstractParser __construct( string $comment)

Constructs a Doc Comment Parser.
  • Access: public

Overridden in child classes as:

PHP_CodeSniffer_CommentParser_FunctionCommentParser::__construct()
Constructs a PHP_CodeSniffer_CommentParser_FunctionCommentParser.

Parameters:

string $comment — The comment to parse.

[ Top ]

getAllowedTags [line 484]

array(string getAllowedTags( )

Returns a list of tags that this comment parser allows for it's comment.

Each tag should indicate if only one entry of this tag can exist in the comment by specifying true as the array value, or false if more than one is allowed. Each tag should ommit the @ symbol. Only tags other than the standard tags should be returned.

  • Return: => boolean)
  • Abstract:
  • Access: protected

Overridden in child classes as:

PHP_CodeSniffer_CommentParser_MemberCommentParser::getAllowedTags()
Returns the allowed tags for this parser.
PHP_CodeSniffer_CommentParser_FunctionCommentParser::getAllowedTags()
Returns the allowed tags that can exist in a function comment.
PHP_CodeSniffer_CommentParser_ClassCommentParser::getAllowedTags()
Returns the allowed tags withing a class comment.

[ Top ]

getComment [line 393]

CommentElement getComment( )

Returns the comment element that appears at the top of this doc comment.
  • Access: public

[ Top ]

getDeprecated [line 421]

SingleElement getDeprecated( )

Returns the deprecated element found in this comment.

Returns null if no element exists in the comment.

  • Access: public

[ Top ]

getLine [line 287]

int getLine( int $tokenPos)

Returns the line that the token exists on in the doc comment.
  • Access: protected

Parameters:

int $tokenPos — The position in the words stack to find the line number for.

[ Top ]

getLinks [line 407]

array(SingleElement) getLinks( )

Returns the link elements found in this comment.

Returns an empty array if no links are found in the comment.

  • Access: public

[ Top ]

getSees [line 381]

array(SingleElement) getSees( )

Returns the see elements that appear in this doc comment.
  • Access: public

[ Top ]

getSince [line 435]

SingleElement getSince( )

Returns the since element found in this comment.

Returns null if no element exists in the comment.

  • Access: public

[ Top ]

parse [line 167]

void parse( )

Initiates the parsing of the doc comment.
  • Throws: PHP_CodeSniffer_CommentParser_ParserException If the parser finds an anomilty with the comment.
  • Access: public

[ Top ]

parseComment [line 322]

DocElement parseComment( array(string) $tokens)

Parses the comment element that appears at the top of the doc comment.
  • Return: The element that represents this comment element.
  • Access: protected

Parameters:

array(string) $tokens — The word tokens that comprise tihs element.

[ Top ]

parseDeprecated [line 337]

DocElement parseDeprecated( array(string) $tokens)

Parses \@deprecated tags.
  • Return: The element that represents this deprecated tag.
  • Access: protected

Parameters:

array(string) $tokens — The word tokens that comprise tihs element.

[ Top ]

parseLink [line 367]

SingleElement parseLink( array(string) $tokens)

Parses \@link tags.
  • Return: The element that represents this link tag.
  • Access: protected

Parameters:

array(string) $tokens — The word tokens that comprise this element.

[ Top ]

parseSee [line 306]

DocElement parseSee( array(string) $tokens)

Parses see tag element within the doc comment.
  • Return: The element that represents this see comment.
  • Access: protected

Parameters:

array(string) $tokens — The word tokens that comprise this element.

[ Top ]

parseSince [line 352]

SingleElement parseSince( array(string) $tokens)

Parses \@since tags.
  • Return: The element that represents this since tag.
  • Access: protected

Parameters:

array(string) $tokens — The word tokens that comprise this element.

[ Top ]

parseTag [line 455]

void parseTag( string $tag, int $start, int $end)

Parses the specified tag.
  • Throws: Exception If the process method for the tag cannot be found.
  • Access: protected

Parameters:

string $tag — The tag name to parse (omitting the @ sybmol from the tag)
int $start — The position in the word tokens where this element started.
int $end — The position in the word tokens where this element ended.

[ Top ]


Documentation generated on 2019年3月11日 14:46:57 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.

AltStyle によって変換されたページ (->オリジナル) /