Validation_Exception
extends UnexpectedValueException
in package
Exception thrown when validation fails.
Table of Contents
- $wp_error : WP_Error
- WP_Error instance.
- $errors : array<string|int, string>
- __construct() : mixed
- create() : static
- create_from_wp_error() : self
- Creates a new instance of the exception.
- get_wp_error() : WP_Error
- Returns the WP_Error instance.
- getErrors() : array<string|int, mixed>
- getHttpStatusCode() : int
- withCode() : static
- withError() : static
- withErrors() : static
- withMessage() : static
Properties
$wp_error
WP_Error instance.
protected
WP_Error
$wp_error
$errors
private
array<string|int, string>
$errors
= []
Methods
__construct()
public
final __construct([string $message = '' ], int $code[, Throwable $previous = null ]) : mixed
Parameters
- $message : string = ''
- $code : int
- $previous : Throwable = null
Return values
mixed —create()
public
static create([Throwable $previous = null ]) : static
Parameters
- $previous : Throwable = null
Return values
static —create_from_wp_error()
Creates a new instance of the exception.
public
static create_from_wp_error(WP_Error $wp_error) : self
Parameters
- $wp_error : WP_Error
-
WP_Error instance.
Return values
self —get_wp_error()
Returns the WP_Error instance.
public
get_wp_error() : WP_Error
Return values
WP_Error —getErrors()
public
getErrors() : array<string|int, mixed>
Return values
array<string|int, mixed> —getHttpStatusCode()
public
getHttpStatusCode() : int
Return values
int —withCode()
public
withCode(int $code) : static
Parameters
- $code : int
Return values
static —withError()
public
withError(string $id, string $error) : static
Parameters
- $id : string
- $error : string
Return values
static —withErrors()
public
withErrors(array<string|int, mixed> $errors) : static
Parameters
- $errors : array<string|int, mixed>
Return values
static —withMessage()
public
withMessage(string $message) : static
Parameters
- $message : string