Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
12 namespace Symfony\Component\HttpKernel\DataCollector; | 12 namespace Symfony\Component\HttpKernel\DataCollector; |
13 | 13 |
14 use Symfony\Component\HttpFoundation\Request; | 14 use Symfony\Component\HttpFoundation\Request; |
15 use Symfony\Component\HttpFoundation\Response; | 15 use Symfony\Component\HttpFoundation\Response; |
16 use Symfony\Component\HttpKernel\KernelInterface; | 16 use Symfony\Component\HttpKernel\KernelInterface; |
17 use Symfony\Component\Stopwatch\Stopwatch; | |
17 | 18 |
18 /** | 19 /** |
19 * TimeDataCollector. | 20 * TimeDataCollector. |
20 * | 21 * |
21 * @author Fabien Potencier <fabien@symfony.com> | 22 * @author Fabien Potencier <fabien@symfony.com> |
23 class TimeDataCollector extends DataCollector implements LateDataCollectorInterface | 24 class TimeDataCollector extends DataCollector implements LateDataCollectorInterface |
24 { | 25 { |
25 protected $kernel; | 26 protected $kernel; |
26 protected $stopwatch; | 27 protected $stopwatch; |
27 | 28 |
28 public function __construct(KernelInterface $kernel = null, $stopwatch = null) | 29 public function __construct(KernelInterface $kernel = null, Stopwatch $stopwatch = null) |
29 { | 30 { |
30 $this->kernel = $kernel; | 31 $this->kernel = $kernel; |
31 $this->stopwatch = $stopwatch; | 32 $this->stopwatch = $stopwatch; |
32 } | 33 } |
33 | 34 |
37 public function collect(Request $request, Response $response, \Exception $exception = null) | 38 public function collect(Request $request, Response $response, \Exception $exception = null) |
38 { | 39 { |
39 if (null !== $this->kernel) { | 40 if (null !== $this->kernel) { |
40 $startTime = $this->kernel->getStartTime(); | 41 $startTime = $this->kernel->getStartTime(); |
41 } else { | 42 } else { |
42 $startTime = $request->server->get('REQUEST_TIME_FLOAT', $request->server->get('REQUEST_TIME')); | 43 $startTime = $request->server->get('REQUEST_TIME_FLOAT'); |
43 } | 44 } |
44 | 45 |
45 $this->data = array( | 46 $this->data = array( |
46 'token' => $response->headers->get('X-Debug-Token'), | 47 'token' => $response->headers->get('X-Debug-Token'), |
47 'start_time' => $startTime * 1000, | 48 'start_time' => $startTime * 1000, |
48 'events' => array(), | 49 'events' => array(), |
49 ); | 50 ); |
51 } | |
52 | |
53 /** | |
54 * {@inheritdoc} | |
55 */ | |
56 public function reset() | |
57 { | |
58 $this->data = array(); | |
59 | |
60 if (null !== $this->stopwatch) { | |
61 $this->stopwatch->reset(); | |
62 } | |
50 } | 63 } |
51 | 64 |
52 /** | 65 /** |
53 * {@inheritdoc} | 66 * {@inheritdoc} |
54 */ | 67 */ |