{ $this->
initialize();
} public function initialize(): void
{ // use private twig instance here, because we use custom template loader
$this->twig =
new TwigEnvironment(new ArrayLoader(),
[ 'cache' =>
new FilesystemCache($this->cacheDir . '/string-template-renderer'
),
]);
$this->
disableTestMode();
foreach ($this->platformTwig->
getExtensions() as $extension) { if ($this->twig->
hasExtension($extension::
class)) { continue;
} $this->twig->
addExtension($extension);
} if ($this->twig->
hasExtension(CoreExtension::
class) &&
$this->platformTwig->
hasExtension(CoreExtension::
class)) { /** @var CoreExtension $coreExtensionInternal */
$coreExtensionInternal =
$this->twig->
getExtension(CoreExtension::
class);
/** @var CoreExtension $coreExtensionGlobal */
$coreExtensionGlobal =
$this->platformTwig->
getExtension(CoreExtension::
class);