WC_Webhook_Data_Store::validate_status()privateWC 3.6.0

Check if a given string is in known statuses, based on return value of @see wc_get_webhook_statuses().

Method of the class: WC_Webhook_Data_Store{}

No Hooks.

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->validate_status( $status );
$status(string) (required)
Status to check.

Changelog

Since 3.6.0 Introduced.

WC_Webhook_Data_Store::validate_status() code WC 9.4.2

private function validate_status( $status ) {
	if ( ! array_key_exists( $status, wc_get_webhook_statuses() ) ) {
		throw new InvalidArgumentException( sprintf( 'Invalid status given: %s. Status must be one of: %s.', $status, implode( ', ', array_keys( wc_get_webhook_statuses() ) ) ) );
	}
}