Automattic\WooCommerce\Internal\ProductFeed\Utils
StringHelper::bool_string
Convert value to boolean string ('true' or 'false')
Method of the class: StringHelper{}
No Hooks.
Returns
String. 'true' or 'false'.
Usage
$result = StringHelper::bool_string( $value ): string;
- $value(mixed) (required)
- Value to convert.
Changelog
| Since 10.5.0 | Introduced. |
StringHelper::bool_string() StringHelper::bool string code WC 10.8.1
public static function bool_string( $value ): string {
if ( is_bool( $value ) ) {
return $value ? 'true' : 'false';
}
if ( is_scalar( $value ) || null === $value ) {
$value = strtolower( (string) $value );
} else {
$value = '';
}
return ( 'true' === $value || '1' === $value || 'yes' === $value ) ? 'true' : 'false';
}