Drupal investigation

TraceableControllerResolver.php 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\HttpKernel\Controller;
  11. use Symfony\Component\Stopwatch\Stopwatch;
  12. use Symfony\Component\HttpFoundation\Request;
  13. /**
  14. * TraceableControllerResolver.
  15. *
  16. * @author Fabien Potencier <fabien@symfony.com>
  17. */
  18. class TraceableControllerResolver implements ControllerResolverInterface
  19. {
  20. private $resolver;
  21. private $stopwatch;
  22. /**
  23. * Constructor.
  24. *
  25. * @param ControllerResolverInterface $resolver A ControllerResolverInterface instance
  26. * @param Stopwatch $stopwatch A Stopwatch instance
  27. */
  28. public function __construct(ControllerResolverInterface $resolver, Stopwatch $stopwatch)
  29. {
  30. $this->resolver = $resolver;
  31. $this->stopwatch = $stopwatch;
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function getController(Request $request)
  37. {
  38. $e = $this->stopwatch->start('controller.get_callable');
  39. $ret = $this->resolver->getController($request);
  40. $e->stop();
  41. return $ret;
  42. }
  43. /**
  44. * {@inheritdoc}
  45. */
  46. public function getArguments(Request $request, $controller)
  47. {
  48. $e = $this->stopwatch->start('controller.get_arguments');
  49. $ret = $this->resolver->getArguments($request, $controller);
  50. $e->stop();
  51. return $ret;
  52. }
  53. }