4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\HttpKernel\Controller;
14 use Symfony\Component\Stopwatch\Stopwatch;
15 use Symfony\Component\HttpFoundation\Request;
18 * @author Fabien Potencier <fabien@symfony.com>
20 class TraceableControllerResolver implements ControllerResolverInterface, ArgumentResolverInterface
24 private $argumentResolver;
26 public function __construct(ControllerResolverInterface $resolver, Stopwatch $stopwatch, ArgumentResolverInterface $argumentResolver = null)
28 $this->resolver = $resolver;
29 $this->stopwatch = $stopwatch;
30 $this->argumentResolver = $argumentResolver;
33 if (null === $this->argumentResolver) {
34 $this->argumentResolver = $resolver;
37 if (!$this->argumentResolver instanceof TraceableArgumentResolver) {
38 $this->argumentResolver = new TraceableArgumentResolver($this->argumentResolver, $this->stopwatch);
45 public function getController(Request $request)
47 $e = $this->stopwatch->start('controller.get_callable');
49 $ret = $this->resolver->getController($request);
59 * @deprecated This method is deprecated as of 3.1 and will be removed in 4.0.
61 public function getArguments(Request $request, $controller)
63 @trigger_error(sprintf('The %s method is deprecated as of 3.1 and will be removed in 4.0. Please use the %s instead.', __METHOD__, TraceableArgumentResolver::class), E_USER_DEPRECATED);
65 $ret = $this->argumentResolver->getArguments($request, $controller);