Automattic\WooCommerce\Internal\StockNotifications\Frontend
SignupRateLimiter::to_bool
Coerce a filtered option to a boolean, accepting the usual 'yes'/'true'/1 spellings.
Method of the class: SignupRateLimiter{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = SignupRateLimiter::to_bool( $value, $fallback ): bool;
- $value(mixed) (required)
- The filtered value.
- $fallback(true|false) (required)
- The value to use when the filtered value spells no boolean.
SignupRateLimiter::to_bool() SignupRateLimiter::to bool code WC 11.3.0
private static function to_bool( $value, bool $fallback ): bool {
if ( is_bool( $value ) ) {
return $value;
}
$filtered = filter_var( $value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE );
return null === $filtered ? $fallback : $filtered;
}