annotate vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 129ea1e6d783
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 /*
Chris@0 4 * This file is part of the Symfony package.
Chris@0 5 *
Chris@0 6 * (c) Fabien Potencier <fabien@symfony.com>
Chris@0 7 *
Chris@0 8 * For the full copyright and license information, please view the LICENSE
Chris@0 9 * file that was distributed with this source code.
Chris@0 10 */
Chris@0 11
Chris@0 12 namespace Symfony\Component\HttpKernel\Controller;
Chris@0 13
Chris@17 14 use Symfony\Component\HttpFoundation\Request;
Chris@0 15 use Symfony\Component\Stopwatch\Stopwatch;
Chris@0 16
Chris@0 17 /**
Chris@0 18 * @author Fabien Potencier <fabien@symfony.com>
Chris@0 19 */
Chris@0 20 class TraceableControllerResolver implements ControllerResolverInterface, ArgumentResolverInterface
Chris@0 21 {
Chris@0 22 private $resolver;
Chris@0 23 private $stopwatch;
Chris@0 24 private $argumentResolver;
Chris@0 25
Chris@0 26 public function __construct(ControllerResolverInterface $resolver, Stopwatch $stopwatch, ArgumentResolverInterface $argumentResolver = null)
Chris@0 27 {
Chris@0 28 $this->resolver = $resolver;
Chris@0 29 $this->stopwatch = $stopwatch;
Chris@0 30 $this->argumentResolver = $argumentResolver;
Chris@0 31
Chris@0 32 // BC
Chris@0 33 if (null === $this->argumentResolver) {
Chris@0 34 $this->argumentResolver = $resolver;
Chris@0 35 }
Chris@0 36
Chris@0 37 if (!$this->argumentResolver instanceof TraceableArgumentResolver) {
Chris@0 38 $this->argumentResolver = new TraceableArgumentResolver($this->argumentResolver, $this->stopwatch);
Chris@0 39 }
Chris@0 40 }
Chris@0 41
Chris@0 42 /**
Chris@0 43 * {@inheritdoc}
Chris@0 44 */
Chris@0 45 public function getController(Request $request)
Chris@0 46 {
Chris@0 47 $e = $this->stopwatch->start('controller.get_callable');
Chris@0 48
Chris@0 49 $ret = $this->resolver->getController($request);
Chris@0 50
Chris@0 51 $e->stop();
Chris@0 52
Chris@0 53 return $ret;
Chris@0 54 }
Chris@0 55
Chris@0 56 /**
Chris@0 57 * {@inheritdoc}
Chris@0 58 *
Chris@0 59 * @deprecated This method is deprecated as of 3.1 and will be removed in 4.0.
Chris@0 60 */
Chris@0 61 public function getArguments(Request $request, $controller)
Chris@0 62 {
Chris@17 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);
Chris@0 64
Chris@0 65 $ret = $this->argumentResolver->getArguments($request, $controller);
Chris@0 66
Chris@0 67 return $ret;
Chris@0 68 }
Chris@0 69 }