예제 #1
0
 /**
  * Write PHP source code that generates top nodes
  * to file.
  * @method  exportNodes
  * @param   string       $filename  Path to file on file system.
  * @return  int|false               Number of bits writen or false on failure.
  */
 public function exportNodes($filename = 'parsedNodes.php')
 {
     // Render top nodes
     $source = '';
     foreach ($this->topNodes as $node) {
         if ($node instanceof NodeAccess) {
             $source .= NodeRenderer::renderRecursive($node);
         } else {
             $source .= NodeRenderer::render($node);
         }
     }
     return FileUtils::write2file($source, $filename, FileUtils::FILE_NEW);
 }
예제 #2
0
 /**
  * Write PHP source code that generates an array containig empty
  * elements.
  * @method  exportEmptyElements
  * @param   string               $filename  Valid path to file.
  * @return  int|false                       No. of bits written or false.
  */
 public function exportEmptyElements($filename = 'emptyElements.php')
 {
     $elements = $this->getEmptyElements();
     $source = NodeRenderer::renderArray($elements, 'elements');
     return FileUtils::write2file($source, $filename, FileUtils::FILE_NEW);
 }