# easy-invoice/2.4.0/includes/Helpers/BooleanHelper.php

Easy Invoice – Invoice Generator, PDF Quotes &amp; Payments, version 2.4.0. 67 lines.

- Page: https://pluginprobe.com/plugins/easy-invoice/2.4.0/code/includes/Helpers/BooleanHelper.php
- Raw: https://pluginprobe.com/plugins/easy-invoice/2.4.0/raw/includes/Helpers/BooleanHelper.php
- Modified: 2025-08-14T09:51:16+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/easy-invoice/2.4.0/code/includes/Helpers/BooleanHelper.php#L10-L20`.

```php
<?php
/**
 * Boolean Helper Class
 *
 * @package     EasyInvoice
 * @author      Your Name
 * @copyright   Copyright (c) 2023, Your Company
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since       1.0.0
 */

namespace EasyInvoice\Helpers;

/**
 * Boolean Helper
 *
 * Handles boolean value conversions and checks.
 *
 * @since 1.0.0
 */
class BooleanHelper {
    
    /**
     * Convert various boolean values to a consistent boolean
     *
     * @since 1.0.0
     * @param mixed $value The value to convert to boolean
     * @return bool
     */
    public static function toBoolean($value): bool {
        if (is_bool($value)) {
            return $value;
        }
        
        if (is_string($value)) {
            return in_array(strtolower($value), ['true', '1', 'yes', 'on'], true);
        }
        
        if (is_numeric($value)) {
            return (bool) $value;
        }
        
        return false;
    }
    
    /**
     * Check if a value represents a true boolean
     *
     * @since 1.0.0
     * @param mixed $value The value to check
     * @return bool
     */
    public static function isTrue($value): bool {
        return self::toBoolean($value);
    }
    
    /**
     * Check if a value represents a false boolean
     *
     * @since 1.0.0
     * @param mixed $value The value to check
     * @return bool
     */
    public static function isFalse($value): bool {
        return !self::toBoolean($value);
    }
} 
```
