Boolean uses ConstantsTrait
A simple enumeration of string representations for boolean values: `"true"` and `"false"`.
This class is useful when working with systems that expect boolean values in string format (e.g. JSON, configuration files, XML, CLI flags, or external APIs).
By providing symbolic constants instead of hardcoded strings, it improves code clarity, consistency, and reduces the risk of typos.
Example:
use oihana\enums\Boolean;
$enabled = Boolean::TRUE;
$disabled = Boolean::FALSE;
echo $enabled; // Outputs: true
Features:
- Uses
ConstantsTraitto support reflection and dynamic access to constants. - Promotes semantic clarity in systems that serialize booleans as strings.
Tags
Table of Contents
Constants
Constants
FALSE
public
string
FALSE
= 'false'
TRUE
public
string
TRUE
= 'true'