Automattic\WooCommerce\Blueprint
StepProcessorResult::add_message
Add a new message.
Method of the class: StepProcessorResult{}
No Hooks.
Returns
null. Nothing (null).
Usage
$StepProcessorResult = new StepProcessorResult(); $StepProcessorResult->add_message( $message, $type );
- $message(string) (required)
- message.
- $type(string)
- one of error, info.
Default:'error'
StepProcessorResult::add_message() StepProcessorResult::add message code WC 10.9.4
public function add_message( string $message, string $type = 'error' ) {
if ( ! in_array( $type, self::MESSAGE_TYPES, true ) ) {
// phpcs:ignore
throw new InvalidArgumentException( "{$type} is not allowed. Type must be one of " . implode( ',', self::MESSAGE_TYPES ) );
}
$this->messages[] = compact( 'message', 'type' );
}