You are here

class Drupal_CommentParser_ReturnElement in Coder 7.2

A class to represent return elements. We need this class because PHP_CodeSniffer_CommentParser_PairElement lacks the getWhitespaceBeforeComment() method.

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

Hierarchy

Expanded class hierarchy of Drupal_CommentParser_ReturnElement

File

coder_sniffer/Drupal/CommentParser/ReturnElement.php, line 25

View source
class Drupal_CommentParser_ReturnElement extends PHP_CodeSniffer_CommentParser_PairElement {

  /**
   * The value of the tag.
   *
   * @var string
   */
  protected $value = '';

  /**
   * The comment of the tag.
   *
   * @var string
   */
  protected $comment = '';

  /**
   * The whitespace that exists before the value elem.
   *
   * @var string
   */
  protected $valueWhitespace = '';

  /**
   * The whitespace that exists before the comment elem.
   *
   * @var string
   */
  protected $commentWhitespace = '';

  /**
   * Processes the sub element with the specified name.
   *
   * @param string $name             The name of the sub element to process.
   * @param string $content          The content of this sub element.
   * @param string $whitespaceBefore The whitespace that exists before the
   *                                 sub element.
   *
   * @return void
   * @see getSubElements()
   */
  protected function processSubElement($name, $content, $whitespaceBefore) {
    $element = $name;
    $whitespace = $element . 'Whitespace';
    $this->{$element} = $content;
    $this->{$whitespace} = $whitespaceBefore;
  }

  //end processSubElement()

  /**
   * Returns the value of the tag.
   *
   * @return string
   */
  public function getValue() {
    return $this->value;
  }

  //end getValue()

  /**
   * Returns the comment associated with the value of this tag.
   *
   * @return string
   */
  public function getComment() {
    return $this->comment;
  }

  //end getComment()

  /**
   * Returns the witespace before the content of this tag.
   *
   * @return string
   */
  public function getWhitespaceBeforeValue() {
    return $this->valueWhitespace;
  }

  //end getWhitespaceBeforeValue()

  /**
   * Returns the witespace before the content of this tag.
   *
   * @return string
   */
  public function getWhitespaceBeforeComment() {
    return $this->commentWhitespace;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Drupal_CommentParser_ReturnElement::$comment protected property The comment of the tag.
Drupal_CommentParser_ReturnElement::$commentWhitespace protected property The whitespace that exists before the comment elem.
Drupal_CommentParser_ReturnElement::$value protected property The value of the tag.
Drupal_CommentParser_ReturnElement::$valueWhitespace protected property The whitespace that exists before the value elem.
Drupal_CommentParser_ReturnElement::getComment public function Returns the comment associated with the value of this tag.
Drupal_CommentParser_ReturnElement::getValue public function Returns the value of the tag.
Drupal_CommentParser_ReturnElement::getWhitespaceBeforeComment public function Returns the witespace before the content of this tag.
Drupal_CommentParser_ReturnElement::getWhitespaceBeforeValue public function Returns the witespace before the content of this tag.
Drupal_CommentParser_ReturnElement::processSubElement protected function Processes the sub element with the specified name.