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

Border_Style_Postprocessor::extract_width_from_shorthand_valueprivateWC 1.0

Extracts the width from a shorthand value.

Метод класса: Border_Style_Postprocessor{}

Хуков нет.

Возвращает

Строку|null. The extracted width or null if no width is found.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->extract_width_from_shorthand_value( $value ): ?string;
$value(строка) (обязательный)
The shorthand value.

Код Border_Style_Postprocessor::extract_width_from_shorthand_value() WC 10.4.3

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

	if ( ! is_array( $parts ) ) {
		return null;
	}

	foreach ( $parts as $part ) {
		if ( preg_match( '/^\d+([a-z%]+)?$/', $part ) ) {
			return $part;
		}
	}

	return null;
}