<<

NAME

ProductOpener::NBooleans - normalize boolean values sent in various formats

DESCRIPTION

FUNCTIONS

normalize_boolean ($value)

Over the years, we have used different ways to store boolean values in products and to get their values from the API. This function normalizes the value to a boolean value (true or false) and returns it.

True values: - true (boolean type) - "true" string - 1 (integer or string) - "checked", "on" (set by HTML checkboxes)

False values: - false (boolean type) - "false" string - 0 (integer) - "" empty string - undef - any other values that are not considered true values

<<