diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index 78495786c50f..9a4784b807ea 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -41,7 +41,6 @@ public function panelAction(Request $request, $token) $panel = $this->container->get('request')->query->get('panel', 'request'); $page = $this->container->get('request')->query->get('page', 'home'); - if (!$profile = $profiler->loadProfile($token)) { return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:info.html.twig', array('about' => 'no_token', 'token' => $token)); } @@ -50,8 +49,7 @@ public function panelAction(Request $request, $token) throw new NotFoundHttpException(sprintf('Panel "%s" is not available for token "%s".', $panel, $token)); } - /** @var $templateManager \Symfony\Bundle\WebProfilerBundle\Profiler\Template */ - $templateManager = $this->container->get('web_profiler.profiler_template'); + $templateManager = $this->container->get('web_profiler.template_manager'); return $this->container->get('templating')->renderResponse($templateManager->getName($profile, $panel), array( 'token' => $token, @@ -182,13 +180,10 @@ public function toolbarAction($token, $position = null) // the profiler is not enabled } - /** @var $templateManager \Symfony\Bundle\WebProfilerBundle\Profiler\Template */ - $templateManager = $this->container->get('web_profiler.profiler_template'); - return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:toolbar.html.twig', array( 'position' => $position, 'profile' => $profile, - 'templates' => $templateManager->getTemplates($profile), + 'templates' => $this->container->get('web_profiler.template_manager')->getTemplates($profile), 'profiler_url' => $url, )); } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php b/src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php index 40643fbf0377..0cf92ea13d9d 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php @@ -22,32 +22,20 @@ * @author Fabien Potencier * @author Artur Wielogórski */ -class TemplateManager { - - /** - * @var \Symfony\Bundle\TwigBundle\TwigEngine - */ +class TemplateManager +{ protected $templating; - - /** - * @var \Twig_Environment - */ protected $twig; - - /** - * @var array - */ protected $templates; - - /** - * @var \Symfony\Component\HttpKernel\Profiler\Profiler - */ protected $profiler; /** - * @param \Symfony\Bundle\TwigBundle\TwigEngine $templating + * Constructor. + * + * @param Profiler $profiler + * @param TwigEngine $templating * @param \Twig_Environment $twig - * @param array $templates + * @param array $templates */ public function __construct(Profiler $profiler, TwigEngine $templating, \Twig_Environment $twig, array $templates) { @@ -58,10 +46,14 @@ public function __construct(Profiler $profiler, TwigEngine $templating, \Twig_En } /** - * @param \Symfony\Component\HttpKernel\Profiler\Profile $profile - * @param $panel + * Gets the template name for a given panel. + * + * @param Profile $profile + * @param string $panel + * * @return mixed - * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + * + * @throws NotFoundHttpException */ public function getName(Profile $profile, $panel) { @@ -75,7 +67,10 @@ public function getName(Profile $profile, $panel) } /** - * @param \Symfony\Component\HttpKernel\Profiler\Profile $profile + * Gets the templates for a given profile. + * + * @param Profile $profile + * * @return array */ public function getTemplates(Profile $profile) @@ -89,10 +84,12 @@ public function getTemplates(Profile $profile) } /** - * Gets template names of templates that are - * present in the viewed profile - * @param \Symfony\Component\HttpKernel\Profiler\Profile $profile + * Gets template names of templates that are present in the viewed profile. + * + * @param Profile $profile + * * @return array + * * @throws \UnexpectedValueException */ protected function getNames(Profile $profile) @@ -123,4 +120,4 @@ protected function getNames(Profile $profile) return $templates; } -} \ No newline at end of file +} diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.xml b/src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.xml index 69771f84a2a5..6741c596bc51 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.xml +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.xml @@ -6,7 +6,7 @@ Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener - Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager + Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager @@ -18,7 +18,7 @@ %web_profiler.debug_toolbar.position% - +