Automattic\WooCommerce\EmailEditor\Engine\Renderer\ContentRenderer\Postprocessors

Border_Style_Postprocessor::extract_style_from_shorthand_valueprivateWC 1.0

Extracts the style from a shorthand value.

Method of the class: Border_Style_Postprocessor{}

No Hooks.

Returns

String|null. The extracted style or null if no style is found.

Usage

// private - for code of main (parent) class only
$result = $this->extract_style_from_shorthand_value( $value ): ?string;
$value(string) (required)
The shorthand value.

Border_Style_Postprocessor::extract_style_from_shorthand_value() code WC 9.9.5

private function extract_style_from_shorthand_value( string $value ): ?string {
	$parts = preg_split( '/\s+/', trim( $value ) );

	foreach ( $parts as $part ) {
		if ( in_array( $part, array( 'none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset' ), true ) ) {
			return $part;
		}
	}

	return null;
}