Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[WebProfilerBundle] tweaked previous merge

  • Loading branch information...
commit 4b054655dbff6b496f4d084e05735b810e0cb95b 1 parent 3f84f72
@fabpot fabpot authored
View
9 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,
));
}
View
51 Profiler/TemplateManager.php
@@ -22,32 +22,20 @@
* @author Fabien Potencier <fabien@symfony.com>
* @author Artur Wielogórski <wodor@wodor.net>
*/
-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;
}
-}
+}
View
4 Resources/config/toolbar.xml
@@ -6,7 +6,7 @@
<parameters>
<parameter key="web_profiler.debug_toolbar.class">Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener</parameter>
- <parameter key="web_profiler.profiler_template">Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager</parameter>
+ <parameter key="web_profiler.template_manager.class">Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager</parameter>
</parameters>
<services>
@@ -18,7 +18,7 @@
<argument>%web_profiler.debug_toolbar.position%</argument>
</service>
- <service id="web_profiler.profiler_template" class="%web_profiler.profiler_template%">
+ <service id="web_profiler.template_manager" class="%web_profiler.template_manager.class%">
<argument type="service" id="profiler" />
<argument type="service" id="templating.engine.twig" />
<argument type="service" id="twig" />
Please sign in to comment.
Something went wrong with that request. Please try again.