|
11 | 11 |
|
12 | 12 | namespace Symfony\Bundle\FrameworkBundle\DataCollector;
|
13 | 13 |
|
14 |
| -use Symfony\Component\HttpFoundation\ParameterBag; |
15 |
| -use Symfony\Component\HttpFoundation\Request; |
16 |
| -use Symfony\Component\HttpFoundation\Response; |
17 |
| -use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector as BaseRequestCollector; |
18 |
| -use Symfony\Component\HttpKernel\Event\FilterControllerEvent; |
19 |
| -use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
| 14 | +use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector as BaseRequestDataCollector; |
| 15 | + |
| 16 | +@trigger_error(sprintf('The "%s" class is deprecated since version 4.1 and will be removed in Symfony 5.0. Use %s instead.', RequestDataCollector::class, BaseRequestDataCollector::class), E_USER_DEPRECATED); |
20 | 17 |
|
21 | 18 | /**
|
22 | 19 | * RequestDataCollector.
|
23 | 20 | *
|
24 | 21 | * @author Jules Pietri <[email protected]>
|
| 22 | + * |
| 23 | + * @deprecated since version 4.1, to be removed in Symfony 5.0 |
25 | 24 | */
|
26 |
| -class RequestDataCollector extends BaseRequestCollector implements EventSubscriberInterface |
| 25 | +class RequestDataCollector extends BaseRequestDataCollector |
27 | 26 | {
|
28 |
| - /** |
29 |
| - * {@inheritdoc} |
30 |
| - */ |
31 |
| - public function collect(Request $request, Response $response, \Exception $exception = null) |
32 |
| - { |
33 |
| - parent::collect($request, $response, $exception); |
34 |
| - |
35 |
| - if ($parentRequestAttributes = $request->attributes->get('_forwarded')) { |
36 |
| - if ($parentRequestAttributes instanceof ParameterBag) { |
37 |
| - $parentRequestAttributes->set('_forward_token', $response->headers->get('x-debug-token')); |
38 |
| - } |
39 |
| - } |
40 |
| - if ($request->attributes->has('_forward_controller')) { |
41 |
| - $this->data['forward'] = array( |
42 |
| - 'token' => $request->attributes->get('_forward_token'), |
43 |
| - 'controller' => $this->parseController($request->attributes->get('_forward_controller')), |
44 |
| - ); |
45 |
| - } |
46 |
| - } |
47 |
| - |
48 |
| - /** |
49 |
| - * Gets the parsed forward controller. |
50 |
| - * |
51 |
| - * @return array|bool An array with keys 'token' the forward profile token, and |
52 |
| - * 'controller' the parsed forward controller, false otherwise |
53 |
| - */ |
54 |
| - public function getForward() |
55 |
| - { |
56 |
| - return isset($this->data['forward']) ? $this->data['forward'] : false; |
57 |
| - } |
58 |
| - |
59 |
| - public function onKernelController(FilterControllerEvent $event) |
60 |
| - { |
61 |
| - $this->controllers[$event->getRequest()] = $event->getController(); |
62 |
| - |
63 |
| - if ($parentRequestAttributes = $event->getRequest()->attributes->get('_forwarded')) { |
64 |
| - if ($parentRequestAttributes instanceof ParameterBag) { |
65 |
| - $parentRequestAttributes->set('_forward_controller', $event->getController()); |
66 |
| - } |
67 |
| - } |
68 |
| - } |
69 |
| - |
70 |
| - /** |
71 |
| - * {@inheritdoc} |
72 |
| - */ |
73 |
| - public function getName() |
74 |
| - { |
75 |
| - return 'request'; |
76 |
| - } |
77 | 27 | }
|
0 commit comments