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); } /**