Class bedezign\yii2\audit\components\Helper

Inheritancebedezign\yii2\audit\components\Helper » yii\base\Object

Helper

Public Methods

Hide inherited methods

MethodDescriptionDefined By
cleanupTrace() Normalize a stack trace so that all entries have the same keys and cleanup the arguments (removes anything that cannot be serialized). bedezign\yii2\audit\components\Helper
cleanupTraceArguments() Cleans up the given data so it can be serialized bedezign\yii2\audit\components\Helper
compact() Enumerate an array and get rid of the values that would exceed the $threshold size when serialized bedezign\yii2\audit\components\Helper
compress() Compress bedezign\yii2\audit\components\Helper
formatAsHTML() If the data contains HTML it will be returned as a pretty printable string bedezign\yii2\audit\components\Helper
formatAsJSON() If the data contains JSON it will be returned as a pretty printable string bedezign\yii2\audit\components\Helper
formatAsQuery() If the data resembles a query string it will be returned as a formatted variable for output bedezign\yii2\audit\components\Helper
formatAsXML() If the data contains XML it will be returned as a pretty printable string bedezign\yii2\audit\components\Helper
generateTrace() Generate a stacktrace and clean it (usually for regular errors) bedezign\yii2\audit\components\Helper
hash() Hash a long string to a short string. bedezign\yii2\audit\components\Helper
serialize() Convert the given value into a gzip compressed blob so it can be stored in the database bedezign\yii2\audit\components\Helper
uncompress() Compress bedezign\yii2\audit\components\Helper
unserialize() Re-inflates and unserializes a blob of compressed data bedezign\yii2\audit\components\Helper

Method Details

cleanupTrace() public static method

Normalize a stack trace so that all entries have the same keys and cleanup the arguments (removes anything that cannot be serialized).

public static array cleanupTrace ( $trace )
$trace array
cleanupTraceArguments() public static method

Cleans up the given data so it can be serialized

public static mixed cleanupTraceArguments ( $args, $recurseDepth 3 )
$args
$recurseDepth int

Amount of recursion cycles before we start replacing data with "Array" etc

compact() public static method

Enumerate an array and get rid of the values that would exceed the $threshold size when serialized

public static array compact ( $data, $simplify false, $threshold 512 )
$data array

Non-array data will be converted to an array

$simplify bool

If true, replace single valued arrays by just its value.

$threshold int

Serialized size to use as maximum

compress() public static method

Compress

public static string compress ( $data )
$data mixed
return string

Binary blob of data

formatAsHTML() public static method

If the data contains HTML it will be returned as a pretty printable string

public static null|string formatAsHTML ( $data )
$data
formatAsJSON() public static method

If the data contains JSON it will be returned as a pretty printable string

public static null|string formatAsJSON ( $data )
$data
formatAsQuery() public static method

If the data resembles a query string it will be returned as a formatted variable for output

public static null|string formatAsQuery ( $data )
$data
formatAsXML() public static method

If the data contains XML it will be returned as a pretty printable string

public static null|string formatAsXML ( $data )
$data
generateTrace() public static method

Generate a stacktrace and clean it (usually for regular errors)

public static array generateTrace ( $skip 2 )
$skip int

Amount of entries to skip (usually 1 or 2). 2 is assuming this helper function and your logging function

hash() public static method

Hash a long string to a short string.

public static string hash ( $data )
$data
serialize() public static method

Convert the given value into a gzip compressed blob so it can be stored in the database

public static string serialize ( $data, $compact true )
$data mixed
$compact bool

True to call the {@link compact()} function first

return string

Binary blob of data

uncompress() public static method

Compress

public static string uncompress ( $data )
$data mixed
return string

Binary blob of data

unserialize() public static method

Re-inflates and unserializes a blob of compressed data

public static mixed unserialize ( $data )
$data string
return mixed

False if an error occurred