| 148 |
lars |
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 TraceableArgumentResolver implements ArgumentResolverInterface
|
|
|
21 |
{
|
|
|
22 |
private ArgumentResolverInterface $resolver;
|
|
|
23 |
private Stopwatch $stopwatch;
|
|
|
24 |
|
|
|
25 |
public function __construct(ArgumentResolverInterface $resolver, Stopwatch $stopwatch)
|
|
|
26 |
{
|
|
|
27 |
$this->resolver = $resolver;
|
|
|
28 |
$this->stopwatch = $stopwatch;
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
/**
|
|
|
32 |
* @param \ReflectionFunctionAbstract|null $reflector
|
|
|
33 |
*/
|
|
|
34 |
public function getArguments(Request $request, callable $controller/* , \ReflectionFunctionAbstract $reflector = null */): array
|
|
|
35 |
{
|
|
|
36 |
$reflector = 2 < \func_num_args() ? func_get_arg(2) : null;
|
|
|
37 |
$e = $this->stopwatch->start('controller.get_arguments');
|
|
|
38 |
|
|
|
39 |
$ret = $this->resolver->getArguments($request, $controller, $reflector);
|
|
|
40 |
|
|
|
41 |
$e->stop();
|
|
|
42 |
|
|
|
43 |
return $ret;
|
|
|
44 |
}
|
|
|
45 |
}
|