protected function newlineBefore(Node $node, $close = FALSE) {
    $prev = $node->previousToken();
    if ($prev instanceof WhitespaceNode) {
      $prev_ws = $prev->previousToken();
      if ($prev_ws instanceof CommentNode && $prev_ws->isLineComment() && $prev->getNewlineCount() === 0) {
        $prev->setText($this->getIndent($close));
      }
      else {
        $prev->setText($this->getNewlineIndent($prev, $close));
      }
    }
    else {
      if ($prev instanceof CommentNode && $prev->isLineComment()) {
        if ($this->indentLevel > 0) {
          $node->before(Token::whitespace($this->getIndent($close)));
        }
      }
      else {
        $node->before(Token::whitespace($this->getNewlineIndent(NULL, $close)));
      }
    }
  }
protected function newlineBefore(Node $node, $close = FALSE) {
    $prev = $node->previousToken();
    if ($prev instanceof WhitespaceNode) {
      $prev_ws = $prev->previousToken();
      if ($prev_ws instanceof CommentNode && $prev_ws->isLineComment() && $prev->getNewlineCount() === 0) {
        $prev->setText($this->getIndent($close));
      }
      else {
        $prev->setText($this->getNewlineIndent($prev, $close));
      }
    }
    else {
      if ($prev instanceof CommentNode && $prev->isLineComment()) {
        if ($this->indentLevel > 0) {
          $node->before(Token::whitespace($this->getIndent($close)));
        }
      }
      else {
        $node->before(Token::whitespace($this->getNewlineIndent(NULL, $close)));
      }
    }
  }
protected function newlineBefore ( Node $ node , $ close = FALSE ) { $ prev = $ node -> previousToken ( ) ; if ( $ prev instanceof WhitespaceNode ) { $ prev_ws = $ prev -> previousToken ( ) ; if ( $ prev_ws instanceof CommentNode && $ prev_ws -> isLineComment ( ) && $ prev -> getNewlineCount ( ) === 0 ) { $ prev -> setText ( $ this -> getIndent ( $ close ) ) ; } else { $ prev -> setText ( $ this -> getNewlineIndent ( $ prev , $ close ) ) ; } } else { if ( $ prev instanceof CommentNode && $ prev -> isLineComment ( ) ) { if ( $ this -> indentLevel > 0 ) { $ node -> before ( Token :: whitespace ( $ this -> getIndent ( $ close ) ) ) ; } } else { $ node -> before ( Token :: whitespace ( $ this -> getNewlineIndent ( NULL , $ close ) ) ) ; } } }
Set so there a newline before a node.

@param Node $node
Node to set newline before.
@param bool $close
If the newline is for before a closing token, eg. ) or }
Set so there a newline before a node .