Twig_Environment::initRuntime PHP Method

initRuntime() public method

Initializes the runtime environment.
public initRuntime ( )
    public function initRuntime()
    {
        $this->runtimeInitialized = true;

        foreach ($this->getExtensions() as $extension) {
            $extension->initRuntime($this);
        }
    }

Usage Example

 protected function setUp()
 {
     parent::setUp();
     $loader = new \Twig_Loader_Filesystem([__DIR__ . '/../../Resources/theme']);
     $cacheDir = sys_get_temp_dir() . '/twig-perf';
     if (!file_exists($cacheDir)) {
         @mkdir($cacheDir);
     }
     $this->twig = new \Twig_Environment($loader, ['debug' => true, 'strict_variables' => true, 'cache' => $cacheDir]);
     $this->extension = new DatagridExtension('datagrid.html.twig');
     $this->twig->addExtension($this->extension);
     $this->twig->initRuntime();
     // load template to ensure a compile, we are only interested in the rendering speed
     $this->twig->loadTemplate('datagrid.html.twig');
 }
All Usage Examples Of Twig_Environment::initRuntime