mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 19:06:40 +00:00
simplified some code
This commit is contained in:
+1
-3
@@ -454,12 +454,10 @@ class Environment
|
||||
|
||||
$this->setLoader($loader);
|
||||
try {
|
||||
$template = $this->loadTemplate($name);
|
||||
return $this->loadTemplate($name);
|
||||
} finally {
|
||||
$this->setLoader($current);
|
||||
}
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1393,30 +1393,17 @@ function twig_include(Environment $env, $context, $template, $variables = [], $w
|
||||
}
|
||||
}
|
||||
|
||||
$result = '';
|
||||
try {
|
||||
$result = $env->resolveTemplate($template)->render($variables);
|
||||
return $env->resolveTemplate($template)->render($variables);
|
||||
} catch (LoaderError $e) {
|
||||
if (!$ignoreMissing) {
|
||||
if ($isSandboxed && !$alreadySandboxed) {
|
||||
$sandbox->disableSandbox();
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
} finally {
|
||||
if ($isSandboxed && !$alreadySandboxed) {
|
||||
$sandbox->disableSandbox();
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if ($isSandboxed && !$alreadySandboxed) {
|
||||
$sandbox->disableSandbox();
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user