JBZoo\Utils\Filter::bool PHP Method

bool() public static method

Converts many english words that equate to true or false to boolean.
public static bool ( string $string ) : boolean
$string string The string to convert to boolean
return boolean
    public static function bool($string)
    {
        $yesList = array('affirmative', 'all right', 'aye', 'indubitably', 'most assuredly', 'ok', 'of course', 'oui', 'okay', 'sure thing', 'y', 'yes', 'yea', 'yep', 'sure', 'yeah', 'true', 't', 'on', '1', 'vrai', 'да', 'д', '+', '++', '+++', '++++', '+++++', '*');
        $noList = array('no*', 'no way', 'nope', 'nah', 'na', 'never', 'absolutely not', 'by no means', 'negative', 'never ever', 'false', 'f', 'off', '0', 'non', 'faux', 'нет', 'н', 'немає', '-');
        $string = Str::low($string);
        if (Arr::in($string, $yesList) || self::float($string) !== 0.0) {
            return true;
        } elseif (Arr::in($string, $noList)) {
            return false;
        }
        return filter_var($string, FILTER_VALIDATE_BOOLEAN);
    }