Class bedezign\yii2\audit\components\Helper
| Inheritance | bedezign\yii2\audit\components\Helper » yii\base\Object |
|---|
Helper
Public Methods
| Method | Description | Defined 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
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 | |
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 |
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 string compress ( $data ) | ||
| $data | mixed | |
| return | string | Binary blob of data |
|---|---|---|
If the data contains HTML it will be returned as a pretty printable string
| public static null|string formatAsHTML ( $data ) | ||
| $data | ||
If the data contains JSON it will be returned as a pretty printable string
| public static null|string formatAsJSON ( $data ) | ||
| $data | ||
If the data resembles a query string it will be returned as a formatted variable for output
| public static null|string formatAsQuery ( $data ) | ||
| $data | ||
If the data contains XML it will be returned as a pretty printable string
| public static null|string formatAsXML ( $data ) | ||
| $data | ||
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 a long string to a short string.
| public static string hash ( $data ) | ||
| $data | ||
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 |
|---|---|---|
Compress
| public static string uncompress ( $data ) | ||
| $data | mixed | |
| return | string | Binary blob of data |
|---|---|---|
Re-inflates and unserializes a blob of compressed data
| public static mixed unserialize ( $data ) | ||
| $data | string | |
| return | mixed | False if an error occurred |
|---|---|---|