示例#1
0
 /**
  * New node is found.
  * @return bool
  */
 public function nodeOpened(MacroNode $node)
 {
     $this->used = TRUE;
     $node->isEmpty = FALSE;
     $node->openingCode = PhpWriter::using($node)->write('<?php if (CacheMacro::createCache($netteCacheStorage, %var, $_g->caches, %node.array?)) { ?>', Strings::random());
 }
示例#2
0
 /**
  * Generates code.
  * @return string
  */
 private function compile(MacroNode $node, $def)
 {
     $node->tokenizer->reset();
     $writer = PhpWriter::using($node, $this->compiler);
     if (is_string($def) && substr($def, 0, 1) !== "") {
         return $writer->write($def);
     } else {
         return Callback::create($def)->invoke($node, $writer);
     }
 }