/**
  * @param BlockNode $node
  *
  * @return string
  */
 protected function printBlockNode(BlockNode $node)
 {
     $childNodes = $node->getChildNodes();
     if ($node->isSubPattern()) {
         $output = '';
         foreach ($childNodes as $childNode) {
             $output .= $this->printNode($childNode);
         }
         return $output;
     }
     return $this->printNode($childNodes[mt_rand(0, count($childNodes) - 1)]);
 }
Esempio n. 2
0
 /**
  * @param BlockNode $node
  *
  * @return \DOMElement
  */
 protected function formatBlockNode(BlockNode $node)
 {
     $xmlNode = $this->createXmlNode($node->getName());
     $xmlNode->setAttribute('sub-pattern', $node->isSubPattern() ? 'true' : 'false');
     return $xmlNode;
 }