/** * Build comments. * * @param array $data Data. * @return \DOMNode */ private function buildComments($data) { $localData = new Data(); if (is_array($data)) { $localData->load($data); } $dataDescription = $this->createNewDataDescription(); $builder = $this->isTree && !$localData->isEmpty() ? new TreeBuilder() : new Builder(); $builder->setData($localData); $builder->setDataDescription($dataDescription); if ($this->isTree && !$localData->isEmpty()) { $tree = TreeConverter::convert($data, 'comment_id', 'comment_parent_id'); $builder->setTree($tree); } $builder->build(); return $builder->getResult(); }