Skip to content

Commit b898878

Browse files
committed
minor #180 Remove an unneeded state in the SourceCodeExtension (stof)
This PR was squashed before being merged into the master branch (closes #180). Discussion ---------- Remove an unneeded state in the SourceCodeExtension Commits ------- aaa30a2 Remove an unneeded state in the SourceCodeExtension
2 parents 5ba1a19 + aaa30a2 commit b898878

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/AppBundle/Twig/SourceCodeExtension.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class SourceCodeExtension extends \Twig_Extension
2424
{
2525
protected $loader;
2626
protected $controller;
27-
protected $template;
2827
protected $kernelRootDir;
2928

3029
public function __construct(\Twig_LoaderInterface $loader, $kernelRootDir)
@@ -48,13 +47,11 @@ public function getFunctions()
4847
);
4948
}
5049

51-
public function showSourceCode(\Twig_Environment $twig, $template)
50+
public function showSourceCode(\Twig_Environment $twig, \Twig_Template $template)
5251
{
53-
$this->template = $template;
54-
5552
return $twig->render('default/_source_code.html.twig', array(
5653
'controller' => $this->getController(),
57-
'template' => $this->getTemplate(),
54+
'template' => $this->getTemplateSource($template),
5855
));
5956
}
6057

@@ -80,9 +77,9 @@ private function getController()
8077
);
8178
}
8279

83-
private function getTemplate()
80+
private function getTemplateSource(\Twig_Template $template)
8481
{
85-
$templateName = $this->template->getTemplateName();
82+
$templateName = $template->getTemplateName();
8683

8784
return array(
8885
'file_path' => $this->kernelRootDir.'/Resources/views/'.$templateName,

0 commit comments

Comments
 (0)