PHP Class Barryvdh\Debugbar\DataCollector\QueryCollector

Inheritance: extends DebugBar\DataCollector\PDO\PDOCollector
Exibir arquivo Open project: barryvdh/laravel-debugbar Class Usage Examples

Protected Properties

Property Type Description
$explainQuery
$explainTypes
$findSource
$queries
$reflection
$renderSqlWithParams
$showHints ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
$timeCollector

Public Methods

Method Description
__construct ( DebugBar\DataCollector\TimeDataCollector $timeCollector = null )
addQuery ( string $query, array $bindings, float $time, Connection $connection )
collect ( ) {@inheritDoc}
getName ( ) {@inheritDoc}
getWidgets ( ) {@inheritDoc}
reset ( ) Reset the queries.
setExplainSource ( boolean $enabled, array | null $types ) Enable/disable the EXPLAIN queries
setFindSource ( boolean $value = true ) Enable/disable finding the source
setRenderSqlWithParams ( boolean $enabled = true, string $quotationChar = "'" ) Renders the SQL of traced statements with params embedded
setShowHints ( boolean $enabled = true ) Show or hide the hints in the parameters

Protected Methods

Method Description
checkBindings ( $bindings ) : mixed Check bindings for illegal (non UTF-8) strings, like Binary data.
escapeBindings ( array $bindings ) : array Make the bindings safe for outputting.
findSource ( ) Use a backtrace to search for the origin of the query.
findViewFromHash ( string $hash ) : null | string Find the template name from the hash.
formatSql ( string $sql ) : string Removes extra spaces at the beginning and end of the SQL query and its lines.
getTwigInfo ( array $trace ) : array Get the filename/line from a Twig template trace
normalizeFilename ( string $path ) : string Shorten the path by removing the relative links and base dir
performQueryAnalysis ( string $query ) : string Explainer::performQueryAnalysis()

Method Details

__construct() public method

public __construct ( DebugBar\DataCollector\TimeDataCollector $timeCollector = null )
$timeCollector DebugBar\DataCollector\TimeDataCollector

addQuery() public method

public addQuery ( string $query, array $bindings, float $time, Connection $connection )
$query string
$bindings array
$time float
$connection Illuminate\Database\Connection

checkBindings() protected method

Check bindings for illegal (non UTF-8) strings, like Binary data.
protected checkBindings ( $bindings ) : mixed
$bindings
return mixed

collect() public method

{@inheritDoc}
public collect ( )

escapeBindings() protected method

Make the bindings safe for outputting.
protected escapeBindings ( array $bindings ) : array
$bindings array
return array

findSource() protected method

Use a backtrace to search for the origin of the query.
protected findSource ( )

findViewFromHash() protected method

Find the template name from the hash.
protected findViewFromHash ( string $hash ) : null | string
$hash string
return null | string

formatSql() protected method

Removes extra spaces at the beginning and end of the SQL query and its lines.
protected formatSql ( string $sql ) : string
$sql string
return string

getName() public method

{@inheritDoc}
public getName ( )

getTwigInfo() protected method

Get the filename/line from a Twig template trace
protected getTwigInfo ( array $trace ) : array
$trace array
return array The file and line

getWidgets() public method

{@inheritDoc}
public getWidgets ( )

normalizeFilename() protected method

Shorten the path by removing the relative links and base dir
protected normalizeFilename ( string $path ) : string
$path string
return string

performQueryAnalysis() protected method

Perform simple regex analysis on the code
Author: e-doceo
protected performQueryAnalysis ( string $query ) : string
$query string
return string

reset() public method

Reset the queries.
public reset ( )

setExplainSource() public method

Enable/disable the EXPLAIN queries
public setExplainSource ( boolean $enabled, array | null $types )
$enabled boolean
$types array | null Array of types to explain queries (select/insert/update/delete)

setFindSource() public method

Enable/disable finding the source
public setFindSource ( boolean $value = true )
$value boolean

setRenderSqlWithParams() public method

Renders the SQL of traced statements with params embedded
public setRenderSqlWithParams ( boolean $enabled = true, string $quotationChar = "'" )
$enabled boolean
$quotationChar string NOT USED

setShowHints() public method

Show or hide the hints in the parameters
public setShowHints ( boolean $enabled = true )
$enabled boolean

Property Details

$explainQuery protected_oe property

protected $explainQuery

$explainTypes protected_oe property

protected $explainTypes

$findSource protected_oe property

protected $findSource

$queries protected_oe property

protected $queries

$reflection protected_oe property

protected $reflection

$renderSqlWithParams protected_oe property

protected $renderSqlWithParams

$showHints protected_oe property

['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
protected $showHints

$timeCollector protected_oe property

protected $timeCollector