8000 feature #24505 [HttpKernel] implement reset() in DumpDataCollector (x… · symfony/symfony@78e5858 · GitHub
[go: up one dir, main page]

Skip to content

Commit 78e5858

Browse files
feature #24505 [HttpKernel] implement reset() in DumpDataCollector (xabbuh)
This PR was merged into the 3.4 branch. Discussion ---------- [HttpKernel] implement reset() in DumpDataCollector | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #24289 | License | MIT | Doc PR | Commits ------- cd602d6 implement reset() in DumpDataCollector
2 parents 6231acc + cd602d6 commit 78e5858

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,16 @@ public function collect(Request $request, Response $response, \Exception $except
164164
}
165165
}
166166

167+
public function reset()
168+
{
169+
$this->stopwatch->reset();
170+
$this->data = array();
171+
$this->dataCount = 0;
172+
$this->isCollected = false;
173+
$this->clonesCount = 0;
174+
$this->clonesIndex = 0;
175+
}
176+
167177
public function serialize()
168178
{
169179
if ($this->clonesCount !== $this->clonesIndex) {

src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\HttpFoundation\Request;
1515
use Symfony\Component\HttpFoundation\Response;
1616
use Symfony\Component\HttpKernel\KernelInterface;
17+
use Symfony\Component\Stopwatch\Stopwatch;
1718

1819
/**
1920
* TimeDataCollector.
@@ -25,7 +26,7 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
2526
protected $kernel;
2627
protected $stopwatch;
2728

28-
public function __construct(KernelInterface $kernel = null, $stopwatch = null)
29+
public function __construct(KernelInterface $kernel = null, Stopwatch $stopwatch = null)
2930
{
3031
$this->kernel = $kernel;
3132
$this->stopwatch = $stopwatch;
@@ -55,6 +56,10 @@ public function collect(Request $request, Response $response, \Exception $except
5556
public function reset()
5657
{
5758
$this->data = array();
59+
60+
if (null !== $this->stopwatch) {
61+
$this->stopwatch->reset();
62+
}
5863
}
5964

6065
/**

0 commit comments

Comments
 (0)
0