You are here

class Drupal_CommentParser_FunctionCommentParser in Coder 7.2

Parses function doc comments.

@category PHP @package PHP_CodeSniffer @link http://pear.php.net/package/PHP_CodeSniffer

Hierarchy

Expanded class hierarchy of Drupal_CommentParser_FunctionCommentParser

File

coder_sniffer/Drupal/CommentParser/FunctionCommentParser.php, line 19

View source
class Drupal_CommentParser_FunctionCommentParser extends PHP_CodeSniffer_CommentParser_FunctionCommentParser {

  /**
   * The parameter elements within this function comment.
   *
   * @var array(Drupal_CommentParser_ParameterElement)
   */
  protected $params = array();

  /**
   * The return element in this function comment.
   *
   * @var Drupal_CommentParser_ReturnElement
   */
  protected $return = null;

  /**
   * Parses parameter elements.
   *
   * @param array(string) $tokens The tokens that conmpise this sub element.
   *
   * @return Drupal_CommentParser_ParameterElement
   */
  protected function parseParam($tokens) {
    $param = new Drupal_CommentParser_ParameterElement($this->previousElement, $tokens, $this->phpcsFile);
    $this->params[] = $param;
    return $param;
  }

  //end parseParam()

  /**
   * Parses return elements.
   *
   * @param array(string) $tokens The tokens that comprise this sub element.
   *
   * @return Drupal_CommentParser_ReturnElement
   */
  protected function parseReturn($tokens) {
    $return = new Drupal_CommentParser_ReturnElement($this->previousElement, $tokens, 'return', $this->phpcsFile);
    $this->return = $return;
    return $return;
  }

  //end parseReturn()

  /**
   * Returns the parameter elements that this function comment contains.
   *
   * Returns an empty array if no parameter elements are contained within
   * this function comment.
   *
   * @return array(Drupal_CommentParser_ParameterElement)
   */
  public function getParams() {
    return $this->params;
  }

  //end getParams()

  /**
   * Returns the return element in this fucntion comment.
   *
   * Returns null if no return element exists in the comment.
   *
   * @return Drupal_CommentParser_ReturnElement
   */
  public function getReturn() {
    return $this->return;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Drupal_CommentParser_FunctionCommentParser::$params protected property The parameter elements within this function comment.
Drupal_CommentParser_FunctionCommentParser::$return protected property The return element in this function comment.
Drupal_CommentParser_FunctionCommentParser::getParams public function Returns the parameter elements that this function comment contains.
Drupal_CommentParser_FunctionCommentParser::getReturn public function Returns the return element in this fucntion comment.
Drupal_CommentParser_FunctionCommentParser::parseParam protected function Parses parameter elements.
Drupal_CommentParser_FunctionCommentParser::parseReturn protected function Parses return elements.