From 4060dd790f8d98b63fc1da5a74c6012839e46495 Mon Sep 17 00:00:00 2001 From: Denis Efremov Date: Fri, 6 Oct 2017 04:27:14 +0300 Subject: [PATCH] I'd wrote like this --- src/Twig/Loader.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Twig/Loader.php b/src/Twig/Loader.php index 78a21f32..688ce792 100644 --- a/src/Twig/Loader.php +++ b/src/Twig/Loader.php @@ -11,8 +11,9 @@ namespace TwigBridge\Twig; -use Twig_LoaderInterface; +use Twig_Source; use Twig_Error_Loader; +use Twig_LoaderInterface; use InvalidArgumentException; use Illuminate\Filesystem\Filesystem; use Illuminate\View\ViewFinderInterface; @@ -92,7 +93,7 @@ public function findTemplate($name) protected function normalizeName($name) { if ($this->files->extension($name) === $this->extension) { - $name = substr($name, 0, - (strlen($this->extension) + 1)); + return $this->files->name($name); } return $name; @@ -133,7 +134,7 @@ public function getSourceContext($name) { $path = $this->findTemplate($name); - return new \Twig_Source($this->files->get($path), $name, $path); + return new Twig_Source($this->files->get($path), $name, $path); } /**