Skip to content

Instantly share code, notes, and snippets.

@Nicofuma
Created May 22, 2014 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nicofuma/f38502d6bd046669b261 to your computer and use it in GitHub Desktop.
Save Nicofuma/f38502d6bd046669b261 to your computer and use it in GitHub Desktop.
<?php
$configuration = new \ProxyManager\Configuration();
$configuration->setProxiesTargetDir($this->phpbb_root_path . '/cache');
spl_autoload_register($configuration->getProxyAutoloader());
$factory = new \ProxyManager\Factory\LazyLoadingValueHolderFactory($configuration);
$twig = $this->twig;
$lexer = $factory->createProxy(
'phpbb\template\twig\lexer',
function (& $wrappedObject, $proxy, $method, $parameters, & $initializer) use ($twig) {
$wrappedObject = new \phpbb\template\twig\lexer($twig); // instantiation logic here
$initializer = null; // turning off further lazy initialization
return true;
}
);
$this->twig->setLexer($lexer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment