示例#1
0
 public function endCommaListNode(CommaListNode $node)
 {
     if ($node->isEmpty()) {
         return;
     }
     $keep_wrap = $this->config['list_keep_wrap'];
     $wrap_if_long = $this->config['list_wrap_if_long'];
     if ($node->parent() instanceof ArrayNode) {
         $keep_wrap = TRUE;
         $wrap_if_long = TRUE;
     }
     $wrap_list = FALSE;
     if ($keep_wrap) {
         $wrap_list = $this->nodeData[$node];
         unset($this->nodeData[$node]);
     }
     if (!$wrap_list && $wrap_if_long) {
         $column_position = $this->calculateColumnPosition($node);
         $column_position += strlen($node->getText());
         $soft_limit = $this->config['soft_limit'];
         $wrap_list = $column_position > $soft_limit;
     }
     if ($wrap_list) {
         $this->newlineBefore($node);
         foreach ($node->children(Filter::isTokenType(',')) as $comma_node) {
             $this->newlineAfter($comma_node);
         }
         $this->newlineAfter($node, TRUE);
     }
 }