Validate a value

@param   mixed   $value Variable to be validated
@return  bool    True when the variable is valid
336688
public function validate($value)
    {
        $value = trim($value);
        return ((string) $value === $this->sanitize($value));
    }
1170195
public function isValid($value)
    {
        if (!preg_match('/^\+?[0-9]{2,12}$/', $value)) {
            $this->error(self::BAD_SYNTAX);
            return false;
        }
        
        return true;
    }
955368
public function isValid($value)
    {
        $valueString = (string) $value;

        $this->_setValue($valueString);

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

        return true;
    }
264066
public function validate($value)
    {
        foreach ($this->items as $item) {
            if ($item->validate($value)) {
                return true;
            }
        }

        return false;
    }
1335174
public function isValid($value)
    {
        $valueString = (string) $value;

        $this->_setValue($valueString);

        if ((ip2long($valueString) === false) || (long2ip(ip2long($valueString)) !== $valueString)) {
            if (!function_exists('inet_pton')) {
                $this->_error();
                return false;
            } else if ((@inet_pton($value) === false) ||(inet_ntop(@inet_pton($value)) !== $valueString)) {
                $this->_error();
                return false;
            }
        }

        return true;
    }
1262671
public function isValid($value)
    {
        if (!is_numeric($value)) {
            $this->_error(self::INVALID);
            return false;
        }

        $this->_setValue($value);
        $value = (float) $value;
        if ($value < 0 || $value > 1) {
            $this->_error(self::NOT_VALID);
            return false;
        }

        return true;
    }
639181
public function isValid($value)
    {
        $this->_setValue($value);
        if (!is_string($value) && !is_int($value)) {
            $this->_error(self::INVALID);
            return false;
        }

        $format = $this->getFormat();
        if (!preg_match($format, $value)) {
            $this->_error(self::NO_MATCH);
            return false;
        }

        return true;
    }
408918
public function validate($value = "")
    {
        if (is_null($value) && $this->isEmptyAllowed()) {
            return true;
        }

        if ($this->isNullNotAllowed() && is_null($value)) {
            return false;
        }

        return true;
    }
634802
public function isValid($value)
    {
        $this->_setValue($value);
        $arr = str_split($value);

        if (preg_match('/[0-9]/', $value) !== 1) {
            $this->_error(self::PASSWORD_NO_NUMBER);
            return false;
        }

        if (count(array_diff($this->_loweCaseLetters, $arr)) === self::LETTERS_COUNT) {
            $this->_error(self::PASSWORD_NO_LOWER_CASE_LETTER);
            return false;
        }

        if (count(array_diff($this->_upperCaseLetters, $arr)) === self::LETTERS_COUNT) {
            $this->_error(self::PASSWORD_NO_UPPER_CASE_LETTER);
            return false;
        }

        return true;
    }
1159397
public function validate($value)
    {
        $value = trim($value);
        $pattern = '/^[a-z]{2}-[A-Z]{2}$/';
        return (empty($value))
                || (is_string($value) && preg_match($pattern, $value) == 1);
    }
507361
protected function _validate($value)
    {
        $value = trim($value);
        $pattern = ComHashtagsDomainEntityHashtag::PATTERN_HASHTAG;

        return (is_string($value) && (preg_match($pattern, $value)) == 1);
    }
655628
protected function checkValidity($value) : bool
    {
        if ('' === $value) {
            return true;
        }
        $date = date_create($value);
        if (false === $date) {
            return false;
        }
        return true;
    }
497094
public function validate($value)
    {
        if (!is_array($value)) {
            return false;
        }

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

        return $this->checkIfAllUniques($value);
    }
346568
public function validateValue($value)
    {
        list($domain, $ip) = explode('/', $value, 2);
        if (($error = (new DomainValidator())->validateValue($domain)) !== null) {
            return $error;
        }
        if ($ip !== null && ($error = (new IpValidator())->validateValue($ip)) !== null) {
            return $error;
        }

        return null;
    }
107090
public function validate($value)
    {
        $messenger = $this->messenger->clear();
        return array_reduce(
            $this->func,
            function (&$result, $func) use ($value, $messenger) {
                return $result && $func($value, $messenger);
            },
            true
        );
    }
1193963
public function isValid($value)
    {
        $valueString = (string) $value;

        $this->_setValue($valueString);

        if ('' === $valueString) {
            $this->_error(self::STRING_EMPTY);
            return false;
        }

        if (null === self::$_filter) {
            /**
             * @see Zend_Filter_Digits
             */
            require_once 'Zend/Filter/Digits.php';
            self::$_filter = new Zend_Filter_Digits();
        }

        if ($valueString !== self::$_filter->filter($valueString)) {
            $this->_error(self::NOT_DIGITS);
            return false;
        }

        return true;
    }
426459
public function isValid($value)
    {
        if (is_null($value)) {
            $result = false;
            $this->error(self::NOT_NULL);
        }
        else
            $result = true;
        return $result;
   }