PHP Class WPDKResult

You rarely instance this class directly. The WPDK provides three classes for manage error, warning and status information feedback. Please check in wpdk-functions.php for is_wpdk_error() too.
Author: =undo= ([email protected])
Inheritance: extends WP_Error
Exibir arquivo Open project: wpxtreme/wpdk Class Usage Examples

Public Methods

Method Description
__construct ( string $code, string $type = WPDKResultType::STATUS, string $message = '', mixed $data = '' ) : WPDKResult Create an instance of WPDKError class
display ( boolean $echo = true, WPDKWatchDog $log = null ) : string | void Display or return a formatted output for WP_Error object. For each error in WP_Error object a formatted output is done with code error and error data.
getVarDump ( mixed $content ) : string Return the var_dump of mixed input
isError ( mixed $thing ) : boolean Looks at the object and if a WPDKError class. Does not check to see if the parent is also WPDKError or a WPDKResult, so can't inherit both the classes and still use this function.
isStatus ( mixed $thing ) : boolean Looks at the object and if a WPDKStatus class. Does not check to see if the parent is also WPDKStatus or a WPDKResult, so can't inherit both the classes and still use this function.
isWarning ( mixed $thing ) : boolean Looks at the object and if a WPDKWarning class. Does not check to see if the parent is also WPDKWarning or a WPDKResult, so can't inherit both the classes and still use this function.

Protected Methods

Method Description
_is ( mixed $thing, string $class = 'WPDKError' ) : boolean Return true if $thing is an object of $class class name
sanitizeCode ( string $code ) : string The code must be a lowercase string with underscore separation.

Method Details

__construct() public method

Create an instance of WPDKError class
public __construct ( string $code, string $type = WPDKResultType::STATUS, string $message = '', mixed $data = '' ) : WPDKResult
$code string A lowercase string code id, ie. wpxcf_no_user_found
$type string A WPDKResultType, default WPDKResultType::STATUS
$message string Error message
$data mixed Optional. Error data.
return WPDKResult

_is() protected static method

Return true if $thing is an object of $class class name
protected static _is ( mixed $thing, string $class = 'WPDKError' ) : boolean
$thing mixed Check if unknown variable is WPDKError object.
$class string Class name
return boolean

display() public method

Display or return a formatted output for WP_Error object. For each error in WP_Error object a formatted output is done with code error and error data.
public display ( boolean $echo = true, WPDKWatchDog $log = null ) : string | void
$echo boolean TRUE to display or FALSE to get output
$log WPDKWatchDog A WPDKWatchDog object to log the display
return string | void Formatted output if $echo is FALSE

getVarDump() public method

Return the var_dump of mixed input
public getVarDump ( mixed $content ) : string
$content mixed Mixed variable to grab
return string

isError() public static method

Looks at the object and if a WPDKError class. Does not check to see if the parent is also WPDKError or a WPDKResult, so can't inherit both the classes and still use this function.
Since: 1.2.0
public static isError ( mixed $thing ) : boolean
$thing mixed Check if unknown variable is WPDKError object.
return boolean TRUE, if WPDKError. FALSE, if not WPDKError.

isStatus() public static method

Looks at the object and if a WPDKStatus class. Does not check to see if the parent is also WPDKStatus or a WPDKResult, so can't inherit both the classes and still use this function.
Since: 1.2.0
public static isStatus ( mixed $thing ) : boolean
$thing mixed Check if unknown variable is WPDKStatus object.
return boolean TRUE, if WPDKStatus. FALSE, if not WPDKStatus.

isWarning() public static method

Looks at the object and if a WPDKWarning class. Does not check to see if the parent is also WPDKWarning or a WPDKResult, so can't inherit both the classes and still use this function.
Since: 1.2.0
public static isWarning ( mixed $thing ) : boolean
$thing mixed Check if unknown variable is WPDKWarning object.
return boolean TRUE, if WPDKWarning. FALSE, if not WPDKWarning.

sanitizeCode() protected method

The code must be a lowercase string with underscore separation.
protected sanitizeCode ( string $code ) : string
$code string
return string