PHP Class Profiler\Profiler

Inheritance: implements Psr\Log\LoggerAwareInterface
Mostra file Open project: loic-sharma/profiler

Public Properties

Property Type Description
$enabled boolean Wether the profiler is enabled or not.
$log Psr\Log\LoggerInterface The logger.

Protected Properties

Property Type Description
$includedFiles array The included files.
$timers array All of the stored timers.

Public Methods

Method Description
__construct ( Psr\Log\LoggerInterface $logger, mixed $startTime = null, boolean $on = true ) : void Register the logger and application start time.
__toString ( ) : string Render the profiler.
disable ( ) : void Disable the profiler.
enable ( boolean $on = true ) : void Enable the profiler.
endTimer ( string $timer, mixed $endTime = null ) : Profiler End a timer.
getElapsedTime ( string $timer ) : double Get the amount of time that passed during a timer.
getIncludedFiles ( ) : array Get all of the files that have been included.
getLoadTime ( ) : integer Get the current application execution time in milliseconds.
getMemoryPeak ( ) : string Get the peak memory usage in a readable format.
getMemoryUsage ( ) : string Get the current memory usage in a readable format.
getTimer ( string $timer ) : double Get a timer.
getTimers ( ) : array Get all of the timers.
isEnabled ( ) : boolean Check if profiler is enabled
render ( ) : string Render the profiler.
setLogger ( Psr\Log\LoggerInterface $logger ) : void Set the logger.
startTimer ( string $timer, mixed $startTime = null ) : Profiler Start a timer.

Protected Methods

Method Description
readableSize ( integer $size, string $format = null ) : string A helper to convert a size into a readable format

Method Details

__construct() public method

Register the logger and application start time.
public __construct ( Psr\Log\LoggerInterface $logger, mixed $startTime = null, boolean $on = true ) : void
$logger Psr\Log\LoggerInterface
$startTime mixed
$on boolean
return void

__toString() public method

Render the profiler.
public __toString ( ) : string
return string

disable() public method

Disable the profiler.
public disable ( ) : void
return void

enable() public method

Enable the profiler.
public enable ( boolean $on = true ) : void
$on boolean
return void

endTimer() public method

End a timer.
public endTimer ( string $timer, mixed $endTime = null ) : Profiler
$timer string
$endTime mixed
return Profiler

getElapsedTime() public method

Get the amount of time that passed during a timer.
public getElapsedTime ( string $timer ) : double
$timer string
return double

getIncludedFiles() public method

Get all of the files that have been included.
public getIncludedFiles ( ) : array
return array

getLoadTime() public method

Get the current application execution time in milliseconds.
public getLoadTime ( ) : integer
return integer

getMemoryPeak() public method

Get the peak memory usage in a readable format.
public getMemoryPeak ( ) : string
return string

getMemoryUsage() public method

Get the current memory usage in a readable format.
public getMemoryUsage ( ) : string
return string

getTimer() public method

Get a timer.
public getTimer ( string $timer ) : double
$timer string
return double

getTimers() public method

Get all of the timers.
public getTimers ( ) : array
return array

isEnabled() public method

Check if profiler is enabled
public isEnabled ( ) : boolean
return boolean

readableSize() protected method

A helper to convert a size into a readable format
protected readableSize ( integer $size, string $format = null ) : string
$size integer
$format string
return string

render() public method

Render the profiler.
public render ( ) : string
return string

setLogger() public method

Set the logger.
public setLogger ( Psr\Log\LoggerInterface $logger ) : void
$logger Psr\Log\LoggerInterface
return void

startTimer() public method

Start a timer.
public startTimer ( string $timer, mixed $startTime = null ) : Profiler
$timer string
$startTime mixed
return Profiler

Property Details

$enabled public_oe property

Wether the profiler is enabled or not.
public bool $enabled
return boolean

$includedFiles protected_oe property

The included files.
protected array $includedFiles
return array

$log public_oe property

The logger.
public LoggerInterface,Psr\Log $log
return Psr\Log\LoggerInterface

$timers protected_oe property

All of the stored timers.
protected array $timers
return array