public static function asBoolean($data, $default = null)
    {
        $boolean = filter_var($data ?? [], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);

        return ! is_null($boolean) ? $boolean : $default;
    }
public static function asBoolean($data, $default = null)
    {
        $boolean = filter_var($data ?? [], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);

        return ! is_null($boolean) ? $boolean : $default;
    }
public static function asBoolean ( $ data , $ default = null ) { $ boolean = filter_var ( $ data ?? [ ] , FILTER_VALIDATE_BOOLEAN , FILTER_NULL_ON_FAILURE ) ; return ! is_null ( $ boolean ) ? $ boolean : $ default ; }
Parameter return as boolean.

@param mixed $data    → data to convert
@param mixed $default → default value in error case

@return mixed → value, null or customized return value
Parameter return as boolean .