| @@ 19-42 (lines=24) @@ | ||
| 16 | use Symfony\Component\HttpKernel\Kernel; |
|
| 17 | ||
| 18 | if (Kernel::VERSION_ID >= 40308) { |
|
| 19 | trait DataCollectorSymfonyCompatibilityTrait |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * {@inheritdoc} |
|
| 23 | */ |
|
| 24 | public function collect(Request $request, Response $response, \Throwable $exception = null) |
|
| 25 | { |
|
| 26 | if (!empty($this->data['queries'])) { |
|
| 27 | // To avoid collection more that once. |
|
| 28 | return; |
|
| 29 | } |
|
| 30 | ||
| 31 | /** @var ProfilingPlugin[] $instances */ |
|
| 32 | $instances = $this->instances; |
|
| 33 | ||
| 34 | foreach ($instances as $instance) { |
|
| 35 | foreach ($instance->getQueries() as $query) { |
|
| 36 | $query['query'] = $this->cloneVar($query['query']); |
|
| 37 | $query['result'] = $this->cloneVar($query['result']); |
|
| 38 | $this->data['queries'][] = $query; |
|
| 39 | } |
|
| 40 | } |
|
| 41 | } |
|
| 42 | } |
|
| 43 | } else { |
|
| 44 | trait DataCollectorSymfonyCompatibilityTrait |
|
| 45 | { |
|
| @@ 44-67 (lines=24) @@ | ||
| 41 | } |
|
| 42 | } |
|
| 43 | } else { |
|
| 44 | trait DataCollectorSymfonyCompatibilityTrait |
|
| 45 | { |
|
| 46 | /** |
|
| 47 | * {@inheritdoc} |
|
| 48 | */ |
|
| 49 | public function collect(Request $request, Response $response, \Exception $exception = null) |
|
| 50 | { |
|
| 51 | if (!empty($this->data['queries'])) { |
|
| 52 | // To avoid collection more that once. |
|
| 53 | return; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** @var ProfilingPlugin[] $instances */ |
|
| 57 | $instances = $this->instances; |
|
| 58 | ||
| 59 | foreach ($instances as $instance) { |
|
| 60 | foreach ($instance->getQueries() as $query) { |
|
| 61 | $query['query'] = $this->cloneVar($query['query']); |
|
| 62 | $query['result'] = $this->cloneVar($query['result']); |
|
| 63 | $this->data['queries'][] = $query; |
|
| 64 | } |
|
| 65 | } |
|
| 66 | } |
|
| 67 | } |
|
| 68 | } |
|
| 69 | ||