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