forked from barryvdh/laravel-debugbar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
91 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
if ( ! function_exists('debug')) { | ||
/** | ||
* Adds one or more messages to the MessagesCollector | ||
* | ||
* @param mixed ...$value | ||
* @return string | ||
*/ | ||
function debug($value) | ||
{ | ||
$debugbar = app('debugbar'); | ||
foreach(func_get_args() as $value){ | ||
$debugbar->addMessage($value, 'debug'); | ||
} | ||
} | ||
} | ||
|
||
if ( ! function_exists('start_measure')) { | ||
/** | ||
* Starts a measure | ||
* | ||
* @param string $name Internal name, used to stop the measure | ||
* @param string $label Public name | ||
*/ | ||
function start_measure($name, $label = null) { | ||
app('debugbar')->startMeasure($name, $label); | ||
} | ||
} | ||
|
||
if ( ! function_exists('stop_measure')) { | ||
/** | ||
* Stop a measure | ||
* | ||
* @param string $name Internal name, used to stop the measure | ||
*/ | ||
function stop_measure($name) { | ||
app('debugbar')->stopMeasure($name); | ||
} | ||
} | ||
|
||
if ( ! function_exists('add_measure')) { | ||
/** | ||
* Adds a measure | ||
* | ||
* @param string $label | ||
* @param float $start | ||
* @param float $end | ||
*/ | ||
function add_measure($label, $start, $end) { | ||
app('debugbar')->addMeasure($label, $start, $end); | ||
} | ||
} | ||
|
||
if ( ! function_exists('measure')) { | ||
/** | ||
* Utility function to measure the execution of a Closure | ||
* | ||
* @param string $label | ||
* @param \Closure $closure | ||
*/ | ||
function measure($label, \Closure $closure) { | ||
app('debugbar')->measure($label, $closure); | ||
} | ||
} |