merged branch dominikzogg/timecollectorfix (PR #8581)
This PR was submitted for the master branch but it was merged into the 2.2 branch instead (closes #8581). Discussion ---------- TimeCollector, Notice, if no events https://github.com/symfony/symfony/issues/8574 Commits ------- e9da1c0 return 0 if there is no valid data
This commit is contained in:
commit
63ef3c1901
|
@ -72,6 +72,10 @@ class TimeDataCollector extends DataCollector
|
||||||
*/
|
*/
|
||||||
public function getDuration()
|
public function getDuration()
|
||||||
{
|
{
|
||||||
|
if (!isset($this->data['events']['__section__'])) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
$lastEvent = $this->data['events']['__section__'];
|
$lastEvent = $this->data['events']['__section__'];
|
||||||
|
|
||||||
return $lastEvent->getOrigin() + $lastEvent->getDuration() - $this->getStartTime();
|
return $lastEvent->getOrigin() + $lastEvent->getDuration() - $this->getStartTime();
|
||||||
|
@ -86,6 +90,10 @@ class TimeDataCollector extends DataCollector
|
||||||
*/
|
*/
|
||||||
public function getInitTime()
|
public function getInitTime()
|
||||||
{
|
{
|
||||||
|
if (!isset($this->data['events']['__section__'])) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->data['events']['__section__']->getOrigin() - $this->getStartTime();
|
return $this->data['events']['__section__']->getOrigin() - $this->getStartTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue