Skip to content

Commit

Permalink
Add returned value to measure()
Browse files Browse the repository at this point in the history
Change-Id: I52e822caaee73bfc70f93e1512710e7893bd362b
  • Loading branch information
vdauchy committed May 12, 2020
1 parent 77f365a commit d8a6f5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"require": {
"php": ">=7.0",
"maximebf/debugbar": "^1.15.1",
"maximebf/debugbar": "^1.16.3",
"illuminate/routing": "^5.5|^6|^7",
"illuminate/session": "^5.5|^6|^7",
"illuminate/support": "^5.5|^6|^7",
Expand Down
6 changes: 4 additions & 2 deletions src/LaravelDebugbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -900,16 +900,18 @@ public function addMeasure($label, $start, $end)
*
* @param string $label
* @param \Closure $closure
* @return mixed
*/
public function measure($label, \Closure $closure)
{
if ($this->hasCollector('time')) {
/** @var \DebugBar\DataCollector\TimeDataCollector $collector */
$collector = $this->getCollector('time');
$collector->measure($label, $closure);
$result = $collector->measure($label, $closure);
} else {
$closure();
$result = $closure();
}
return $result;
}

/**
Expand Down

0 comments on commit d8a6f5b

Please sign in to comment.