PHP Class Kint

显示文件 Open project: raveren/kint Class Usage Examples

Public Properties

Property Type Description
$aliases
$appRootDirs
$charEncodings
$cliColors
$cliDetection
$displayCalledFrom
$expandedByDefault
$fileLinkFormat
$maxLevels
$maxStrLength
$returnOutput # stores mode and active statuses
$theme

Public Methods

Method Description
dump ( mixed $data = null ) : void | string Dump information about variables, accepts any number of parameters, supports modifiers:
enabled ( mixed $forceMode = null ) : mixed Enables or disables Kint, can globally enforce the rendering mode. If called without parameters, returns the current mode.
getIdeLink ( $file, $line )
shortenPath ( string $file ) : string generic path display callback, can be configured in the settings; purpose is to show relevant path info and hide as much of the path as possible.
trace ( array $trace = null ) : mixed Prints a debug backtrace, same as Kint::dump(1)

Private Methods

Method Description
_getCalleeInfo ( array $trace ) : array( returns parameter names that the function was passed, as well as any predefined symbols before function call (modifiers)
_parseTrace ( array $data )
_removeAllButCode ( string $source ) : string removes comments and zaps whitespace &
_showSource ( string $file, integer $lineNumber, integer $padding = 7 ) : boolean | string trace helper, shows the place in code inline
_stepIsInternal ( $step ) : array returns whether current trace step belongs to Kint or its wrappers

Method Details

dump() public static method

clean up any output before kint and place the dump at the top of page: - Kint::dump() ***** expand all nodes on display: ! Kint::dump() ***** dump variables disregarding their depth: + Kint::dump() ***** return output instead of displaying it: @ Kint::dump() ***** force output as plain text ~ Kint::dump() Modifiers are supported by all dump wrapper functions, including Kint::trace(). Space is optional. You can also use the following shorthand to display debug_backtrace(): Kint::dump( 1 ); Passing the result from debug_backtrace() to kint::dump() as a single parameter will display it as trace too: $trace = debug_backtrace( true ); Kint::dump( $trace ); Or simply: Kint::dump( debug_backtrace() );
public static dump ( mixed $data = null ) : void | string
$data mixed
return void | string

enabled() public static method

Enables or disables Kint, can globally enforce the rendering mode. If called without parameters, returns the current mode.
public static enabled ( mixed $forceMode = null ) : mixed
$forceMode mixed null or void - return current mode false - disable (no output) true - enable and detect cli automatically Kint::MODE_* - enable and force selected mode disregarding detection and function shorthand (s()/d()), note that you can still override this with the "~" modifier
return mixed previously set value if a new one is passed

shortenPath() public static method

generic path display callback, can be configured in the settings; purpose is to show relevant path info and hide as much of the path as possible.
public static shortenPath ( string $file ) : string
$file string
return string

trace() public static method

Prints a debug backtrace, same as Kint::dump(1)
public static trace ( array $trace = null ) : mixed
$trace array [OPTIONAL] you can pass your own trace, otherwise, `debug_backtrace` will be called
return mixed

Property Details

$aliases public_oe static_oe property

public static $aliases

$appRootDirs public_oe static_oe property

public static $appRootDirs

$charEncodings public_oe static_oe property

public static $charEncodings

$cliColors public_oe static_oe property

public static $cliColors

$cliDetection public_oe static_oe property

public static $cliDetection

$displayCalledFrom public_oe static_oe property

public static $displayCalledFrom

$expandedByDefault public_oe static_oe property

public static $expandedByDefault

$fileLinkFormat public_oe static_oe property

public static $fileLinkFormat

$maxLevels public_oe static_oe property

public static $maxLevels

$maxStrLength public_oe static_oe property

public static $maxStrLength

$returnOutput public_oe static_oe property

# stores mode and active statuses
public static $returnOutput

$theme public_oe static_oe property

public static $theme