isFloat example

$actual = self::getValue($customFields$renderedField);
        $expected = self::getExpectedValue($renderedFieldValue$renderedField);

        if ($actual === null) {
            if ($operator === Rule::OPERATOR_NEQ) {
                return $actual !== $expected;
            }

            return false;
        }

        if (self::isFloat($renderedField)) {
            return self::floatMatch($operator(float) $actual(float) $expected);
        }

        return match ($operator) {
            Rule::OPERATOR_NEQ => $actual !== $expected,
            Rule::OPERATOR_GTE => $actual >= $expected,
            Rule::OPERATOR_LTE => $actual <= $expected,
            Rule::OPERATOR_EQ => $actual === $expected,
            Rule::OPERATOR_GT => $actual > $expected,
            Rule::OPERATOR_LT => $actual < $expected,
            default => throw new UnsupportedOperatorException($operator, self::class),
        };
if (!is_string($value) && !is_int($value) && !is_float($value)) {
            $this->_error(self::INVALID);
            return false;
        }

        if (is_float($value)) {
            return true;
        }

        $this->_setValue($value);
        try {
            if (!Zend_Locale_Format::isFloat($value, array('locale' => $this->_locale))) {
                $this->_error(self::NOT_FLOAT);
                return false;
            }
        } catch (Zend_Locale_Exception $e) {
            $this->_error(self::NOT_FLOAT);
            return false;
        }

        return true;
    }
}
Home | Imprint | This part of the site doesn't use cookies.