if ($isSandboxed =
$sandboxed &&
$env->
hasExtension(SandboxExtension::
class)) { $sandbox =
$env->
getExtension(SandboxExtension::
class);
if (!
$alreadySandboxed =
$sandbox->
isSandboxed()) { $sandbox->
enableSandbox();
} foreach ((\
is_array($template) ?
$template :
[$template]) as $name) { // if a Template instance is passed, it might have been instantiated outside of a sandbox, check security
if ($name instanceof TemplateWrapper ||
$name instanceof Template
) { $name->
unwrap()->
checkSecurity();
} } } try { $loaded = null;
try { $loaded =
$env->
resolveTemplate($template);
} catch (LoaderError
$e) { if (!
$ignoreMissing) { throw $e;
}