Automattic\WooCommerce\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors

Spacing_Preprocessor::is_zero_valueprivateWC 1.0

Checks whether a CSS value is explicitly zero.

Matches '0', '0px', '0em', '0rem', '0%', etc.

Method of the class: Spacing_Preprocessor{}

No Hooks.

Returns

true|false. True if the value is explicitly zero.

Usage

// private - for code of main (parent) class only
$result = $this->is_zero_value( $value ): bool;
$value(mixed) (required)
The CSS value to check.

Spacing_Preprocessor::is_zero_value() code WC 10.8.1

private function is_zero_value( $value ): bool {
	if ( ! is_string( $value ) && ! is_numeric( $value ) ) {
		return false;
	}

	return (bool) preg_match( '/^0(%|[a-z]*)?$/i', trim( (string) $value ) );
}