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