implement reset() in DumpDataCollector

This commit is contained in:
Christian Flothmann 2017-10-10 13:14:08 +02:00
parent 6231acc8e8
commit cd602d691a
2 changed files with 16 additions and 1 deletions

View File

@ -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) {

View File

@ -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();
}
}
/**