children() public method

Return children comments, if applicable
public children ( ) : CommentArray
return CommentArray
コード例 #1
0
 /**
  * Walk the tree and register comments in the corresponding collections.
  *
  * @param   array    $nodes
  * @param   Comment  $parent
  */
 protected function walk(&$nodes, $parent = null)
 {
     $collection = $parent instanceof Comment ? $parent->children() : $this;
     foreach ($nodes as $entry) {
         $node = $entry['node'];
         $children =& $entry['children'];
         $node->parent($parent);
         $collection->set($node->id(), $node);
         if (!empty($children)) {
             $this->walk($children, $node);
         }
     }
 }