/** * @param RepetitionNode $node * * @return string */ protected function printRepetitionNode(RepetitionNode $node) { if ($node->getMax() !== null) { $count = mt_rand($node->getMin(), $node->getMax()); } else { $count = mt_rand($node->getMin(), $node->getMin() + 5); } $output = ''; for ($i = 0; $i < $count; ++$i) { foreach ($node->getChildNodes() as $childNode) { $output .= $this->printNode($childNode); } } return $output; }