StepProcessorResult
in package
A class returned by StepProcessor classes containing result of the process and messages.
Table of Contents
- MESSAGE_TYPES = array('error', 'info', 'debug', 'warn')
- $messages : array<string|int, mixed>
- Messages
- $step_name : string
- Step name
- $success : bool
- Indicate whether the process was success or not
- __construct() : mixed
- Construct.
- add_debug() : void
- Add a new debug message.
- add_error() : void
- Add a new error message.
- add_info() : void
- Add a new info message.
- add_message() : void
- Add a new message.
- add_warn() : void
- Add a new warn message.
- get_messages() : array<string|int, mixed>
- Filter messages.
- get_step_name() : string
- Get the name of the step.
- is_success() : bool
- Check to see if the result was success.
- merge_messages() : void
- Merge messages from another StepProcessorResult instance.
- set_step_name() : void
- Get messages.
- success() : StepProcessorResult
- Create a new instance with $success = true.
Constants
MESSAGE_TYPES
public
mixed
MESSAGE_TYPES
= array('error', 'info', 'debug', 'warn')
Properties
$messages
Messages
private
array<string|int, mixed>
$messages
= array()
$step_name
Step name
private
string
$step_name
$success
Indicate whether the process was success or not
private
bool
$success
Methods
__construct()
Construct.
public
__construct(bool $success, string $step_name) : mixed
Parameters
- $success : bool
-
Indicate whether the process was success or not.
- $step_name : string
-
The name of the step.
Return values
mixed —add_debug()
Add a new debug message.
public
add_debug(string $message) : void
Parameters
- $message : string
-
message.
Return values
void —add_error()
Add a new error message.
public
add_error(string $message) : void
Parameters
- $message : string
-
message.
Return values
void —add_info()
Add a new info message.
public
add_info(string $message) : void
Parameters
- $message : string
-
message.
Return values
void —add_message()
Add a new message.
public
add_message(string $message[, string $type = 'error' ]) : void
Parameters
- $message : string
-
message.
- $type : string = 'error'
-
one of error, info.
Tags
Return values
void —add_warn()
Add a new warn message.
public
add_warn(string $message) : void
Parameters
- $message : string
-
message.
Return values
void —get_messages()
Filter messages.
public
get_messages([string $type = 'all' ]) : array<string|int, mixed>
Parameters
- $type : string = 'all'
-
one of all, error, and info.
Return values
array<string|int, mixed> —get_step_name()
Get the name of the step.
public
get_step_name() : string
Return values
string — The name of the step.is_success()
Check to see if the result was success.
public
is_success() : bool
Return values
bool —merge_messages()
Merge messages from another StepProcessorResult instance.
public
merge_messages(StepProcessorResult $other) : void
Parameters
- $other : StepProcessorResult
-
The other StepProcessorResult instance.
Return values
void —set_step_name()
Get messages.
public
set_step_name(string $step_name) : void
Parameters
- $step_name : string
-
The name of the step.
Return values
void —success()
Create a new instance with $success = true.
public
static success(string $stp_name) : StepProcessorResult
Parameters
- $stp_name : string
-
The name of the step.