Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\HttpKernel\Controller; Chris@0: Chris@17: use Symfony\Component\HttpFoundation\Request; Chris@0: use Symfony\Component\Stopwatch\Stopwatch; Chris@0: Chris@0: /** Chris@0: * @author Fabien Potencier Chris@0: */ Chris@0: class TraceableControllerResolver implements ControllerResolverInterface, ArgumentResolverInterface Chris@0: { Chris@0: private $resolver; Chris@0: private $stopwatch; Chris@0: private $argumentResolver; Chris@0: Chris@0: public function __construct(ControllerResolverInterface $resolver, Stopwatch $stopwatch, ArgumentResolverInterface $argumentResolver = null) Chris@0: { Chris@0: $this->resolver = $resolver; Chris@0: $this->stopwatch = $stopwatch; Chris@0: $this->argumentResolver = $argumentResolver; Chris@0: Chris@0: // BC Chris@0: if (null === $this->argumentResolver) { Chris@0: $this->argumentResolver = $resolver; Chris@0: } Chris@0: Chris@0: if (!$this->argumentResolver instanceof TraceableArgumentResolver) { Chris@0: $this->argumentResolver = new TraceableArgumentResolver($this->argumentResolver, $this->stopwatch); Chris@0: } Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function getController(Request $request) Chris@0: { Chris@0: $e = $this->stopwatch->start('controller.get_callable'); Chris@0: Chris@0: $ret = $this->resolver->getController($request); Chris@0: Chris@0: $e->stop(); Chris@0: Chris@0: return $ret; Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: * Chris@0: * @deprecated This method is deprecated as of 3.1 and will be removed in 4.0. Chris@0: */ Chris@0: public function getArguments(Request $request, $controller) Chris@0: { Chris@17: @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); Chris@0: Chris@0: $ret = $this->argumentResolver->getArguments($request, $controller); Chris@0: Chris@0: return $ret; Chris@0: } Chris@0: }