Skip to content

Remove an unneeded state in the SourceCodeExtension #180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/AppBundle/Twig/SourceCodeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class SourceCodeExtension extends \Twig_Extension
{
protected $loader;
protected $controller;
protected $template;
protected $kernelRootDir;

public function __construct(\Twig_LoaderInterface $loader, $kernelRootDir)
Expand All @@ -48,13 +47,11 @@ public function getFunctions()
);
}

public function showSourceCode(\Twig_Environment $twig, $template)
public function showSourceCode(\Twig_Environment $twig, \Twig_Template $template)
{
$this->template = $template;

return $twig->render('default/_source_code.html.twig', array(
'controller' => $this->getController(),
'template' => $this->getTemplate(),
'template' => $this->getTemplateSource($template),
));
}

Expand All @@ -80,9 +77,9 @@ private function getController()
);
}

private function getTemplate()
private function getTemplateSource(\Twig_Template $template)
{
$templateName = $this->template->getTemplateName();
$templateName = $template->getTemplateName();

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