Validate the value

@param mixed $value Value to check
@return bool False if invalid, true if valid
423476
protected function isValidCache($value): bool
    {
        $result = false;

        $parentResult = parent::isValidCache($value);
        if ($parentResult === false) {
            return $result;
        }

        $path = array_key_exists('path', $value) ? $value['path'] : '';
        try {
            Utility::validatePath($path);
        } catch (InvalidArgumentException $e) {
            $this->errors[] = "Path does not exist or is not readable: $path";

            return $result;
        }

        $md5 = array_key_exists('md5', $value) ? $value['md5'] : '';
        $content = (string)file_get_contents($value['path']);
        if (md5($content) <> $md5) {
            $this->warnings[] = 'Stale cache found. Cleaning up and ignoring';

            return $result;
        }

        $result = true;

        return $result;
    }
735805
protected function _validate($value)
    {
        $value = trim($value);
        return ((string) $value === $this->sanitize($value));
    }
1259765
public function isValueValid($value) {
		return $value instanceof Type\CreativeWorkType || $value instanceof Type\HowToSectionType || $value instanceof Type\HowToStepType || $value instanceof DataType\TextType;
	}
507361
protected function _validate($value)
    {
        $value = trim($value);
        $pattern = ComHashtagsDomainEntityHashtag::PATTERN_HASHTAG;

        return (is_string($value) && (preg_match($pattern, $value)) == 1);
    }
1170195
public function isValid($value)
    {
        if (!preg_match('/^\+?[0-9]{2,12}$/', $value)) {
            $this->error(self::BAD_SYNTAX);
            return false;
        }
        
        return true;
    }
899793
public function isValid($value)
    {
        if ($value !== null && !is_string($value) && !is_int($value) && !is_float($value) &&
            !is_bool($value) && !is_array($value) && !is_object($value)) {
            $this->_error(self::INVALID);
            return false;
        }

        $type    = $this->getType();
        $this->_setValue($value);
        $object  = false;

        // OBJECT_COUNT (countable object)
        if ($type >= self::OBJECT_COUNT) {
            $type -= self::OBJECT_COUNT;
            $object = true;

            if (is_object($value) && ($value instanceof Countable) && (count($value) == 0)) {
                $this->_error(self::IS_EMPTY);
                return false;
            }
        }

        // OBJECT_STRING (object's toString)
        if ($type >= self::OBJECT_STRING) {
            $type -= self::OBJECT_STRING;
            $object = true;

            if ((is_object($value) && (!method_exists($value, '__toString'))) ||
                (is_object($value) && (method_exists($value, '__toString')) && (((string) $value) == ""))) {
                $this->_error(self::IS_EMPTY);
                return false;
            }
        }

        // OBJECT (object)
        if ($type >= self::OBJECT) {
            $type -= self::OBJECT;
            // fall trough, objects are always not empty
        } else if ($object === false) {
            // object not allowed but object given -> return false
            if (is_object($value)) {
                $this->_error(self::IS_EMPTY);
                return false;
            }
        }

        // SPACE ('   ')
        if ($type >= self::SPACE) {
            $type -= self::SPACE;
            if (is_string($value) && (preg_match('/^\s+$/s', $value))) {
                $this->_error(self::IS_EMPTY);
                return false;
            }
        }

        // NULL (null)
        if ($type >= self::NULL) {
            $type -= self::NULL;
            if ($value === null) {
                $this->_error(self::IS_EMPTY);
                return false;
            }
        }

        // EMPTY_ARRAY (array())
        if ($type >= self::EMPTY_ARRAY) {
            $type -= self::EMPTY_ARRAY;
            if (is_array($value) && ($value == array())) {
                $this->_error(self::IS_EMPTY);
                return false;
            }
        }

        // ZERO ('0')
        if ($type >= self::ZERO) {
            $type -= self::ZERO;
            if (is_string($value) && ($value == '0')) {
                $this->_error(self::IS_EMPTY);
                return false;
            }
        }

        // STRING ('')
        if ($type >= self::STRING) {
            $type -= self::STRING;
            if (is_string($value) && ($value == '')) {
                $this->_error(self::IS_EMPTY);
                return false;
            }
        }

        // FLOAT (0.0)
        if ($type >= self::FLOAT) {
            $type -= self::FLOAT;
            if (is_float($value) && ($value == 0.0)) {
                $this->_error(self::IS_EMPTY);
                return false;
            }
        }

        // INTEGER (0)
        if ($type >= self::INTEGER) {
            $type -= self::INTEGER;
            if (is_int($value) && ($value == 0)) {
                $this->_error(self::IS_EMPTY);
                return false;
            }
        }

        // BOOLEAN (false)
        if ($type >= self::BOOLEAN) {
            $type -= self::BOOLEAN;
            if (is_bool($value) && ($value == false)) {
                $this->_error(self::IS_EMPTY);
                return false;
            }
        }

        return true;
    }
1288249
public function validate($value)
    {
        if (!is_numeric($value)) {
            return false;
        }
        // Convert possible strings to number
        $number = $value + 0;

        return is_double($number) || !$this->strict && is_int($number);
    }
879189
public function validateValue($value)
    {
        // make sure string length is limited to avoid DOS attacks
        $valid = is_string($value) && strlen($value) <= 254 && (preg_match($this->pattern, $value) || $this->allowName && preg_match($this->fullPattern, $value));
        return $valid;
    }
841269
protected function _validate($value)
    {
        $value = trim(str_replace('\\', '/', $value));
        return (is_string($value) && (preg_match(self::PATTERN, $value)) == 1);
    }
426459
public function isValid($value)
    {
        if (is_null($value)) {
            $result = false;
            $this->error(self::NOT_NULL);
        }
        else
            $result = true;
        return $result;
   }
950210
public function isValueValid($value) {
		return $value instanceof DataType\BooleanType || $value instanceof DataType\NumberType || $value instanceof Type\StructuredValueType || $value instanceof DataType\TextType;
	}
376040
public function isValueValid($value) {
		return $value instanceof DataType\NumberType || $value instanceof Type\PriceSpecification || $value instanceof DataType\TextType;
	}
135337
public function isValid($value)
    {
        $result = filter_var($value, FILTER_VALIDATE_INT);
        if (!$result) {
            $this->addMessage('number');
        }
        return ($result === false) ? false : true;
    }
850270
public function validate($value) {
        $dateTime = \DateTime::createFromFormat($this->format, $value);
        if(!$dateTime instanceof \DateTime || $dateTime->format($this->format)!=$value) {
            return new ValidationResult(false, 'Invalid date');
        }

        return new ValidationResult(true);
    }
117248
public function validate($value)
    {
        $value = trim($value);
        return (is_string($value) && ($value === filter_var($value, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES)));
    }
1319492
protected function isValueValid($value) {
		$this->checkValue($value);
		
		if ($this->validatable === null) {
			return true;
		}
		
		return $this->validatable->testEiFieldValue($this->eiu, $value);
	}
121216
public static function isValid($value)
    {
        if (!is_string($value)) {
            return false;
        }

        $type = self::getType($value);

        return !($type === null);
    }