getKernel() public method

Get the current kernel
public getKernel ( ) : Kernel
return Kernel the kernel
Example #1
0
 public function process(Parser $parser, $node, $variable, $data, array $options)
 {
     $environment = $parser->getEnvironment();
     $kernel = $parser->getKernel();
     $files = array();
     foreach (explode("\n", $node->getValue()) as $file) {
         $file = trim($file);
         if ($file) {
             $environment->addDependency($file);
             $files[] = $file;
         }
     }
     $document = $parser->getDocument();
     $document->addNode($kernel->build('Nodes\\TocNode', $files, $environment, $options));
 }
Example #2
0
 public function process(Parser $parser, $node, $variable, $data, array $options)
 {
     if ($node) {
         $kernel = $parser->getKernel();
         if ($node instanceof CodeNode) {
             $node->setLanguage(trim($data));
         }
         if ($variable) {
             $environment = $parser->getEnvironment();
             $environment->setVariable($variable, $node);
         } else {
             $document = $parser->getDocument();
             $document->addNode($node);
         }
     }
 }