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
This commit is contained in:
commit
78e5858495
|
@ -164,6 +164,16 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
|||
}
|
||||
}
|
||||
|
||||
public function reset()
|
||||
{
|
||||
$this->stopwatch->reset();
|
||||
$this->data = array();
|
||||
$this->dataCount = 0;
|
||||
$this->isCollected = false;
|
||||
$this->clonesCount = 0;
|
||||
$this->clonesIndex = 0;
|
||||
}
|
||||
|
||||
public function serialize()
|
||||
{
|
||||
if ($this->clonesCount !== $this->clonesIndex) {
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace Symfony\Component\HttpKernel\DataCollector;
|
|||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Symfony\Component\Stopwatch\Stopwatch;
|
||||
|
||||
/**
|
||||
* TimeDataCollector.
|
||||
|
@ -25,7 +26,7 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
|
|||
protected $kernel;
|
||||
protected $stopwatch;
|
||||
|
||||
public function __construct(KernelInterface $kernel = null, $stopwatch = null)
|
||||
public function __construct(KernelInterface $kernel = null, Stopwatch $stopwatch = null)
|
||||
{
|
||||
$this->kernel = $kernel;
|
||||
$this->stopwatch = $stopwatch;
|
||||
|
@ -55,6 +56,10 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
|
|||
public function reset()
|
||||
{
|
||||
$this->data = array();
|
||||
|
||||
if (null !== $this->stopwatch) {
|
||||
$this->stopwatch->reset();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Reference in New Issue