Perform validation against given value

@param $value

@throws ValidationException
@return $this
427053
protected function validate(&$value)
    {
        $mongoId = Entity::getInstance()->getDatabase()->isId($value);

        if (!$this->isNull($value) && !is_array($value) && !$this->isInstanceOf($value, AbstractEntity::class) && !$mongoId) {
            $this->expected('entity ID, instance of ' . AbstractEntity::class . ' or null', gettype($value));
        }

        return $this;
    }
439861
public function eq($value) {
        $this->rule = $value;
        $this->check_role = 'eq';
        $result = !is_null($this->value) && $this->value == $value;
        $this->checkResult($result);
        return $this;
    }
1259311
public function validate($value)
    {
        //Use string's validator
        $return = parent::validate($value);

        //Apply additional rules
        if ($return->status == true) {
            if (filter_var($value, FILTER_VALIDATE_URL) === false) {
                //error
                $return->status = false;
                $return->errorObject = new IncorrectParametersException([
                    [
                        'type' => static::getType(),
                        'failure' => 'format'
                    ]
                ]);
            }
        }

        return $return;
    }
673842
public function valid($value)
    {

        foreach($this->getRules() as $index => $rule) {

            // check for required
            if (in_array($value, ['', null]) && !$this->hasRule('required')) {
                continue;
            }

            // extract params
            list($method, $params) = $rule;

            // If method is null, we use the index as the method name
            $method = is_null($method) ? $index : $method;

            // Build the params
            array_unshift($params, $value);

            // If it's a anonymous function
            if (!is_string($method) && is_callable($method)) {

                if (!call_user_func_array($method, $params)) {
                    $this->addError($index, $this->formatError($index, $params));
                }

            } else {// if it's a local method

                if (!method_exists($this, $method)) {
                    throw new \Exception('Method "'. $method .'" not found for validator : ' . $index);
                }

                if (!call_user_func_array([$this, $method], $params)) {
                    $this->addError($index, $this->formatError($index, $params));
                }
            }
        }

        return $this;
    }
841269
protected function _validate($value)
    {
        $value = trim(str_replace('\\', '/', $value));
        return (is_string($value) && (preg_match(self::PATTERN, $value)) == 1);
    }
1221198
public function setValue($value)
    {
        parent::setValue($value);
        $this->setCheckboxesAttributes($value, $this->checkboxes);

        return $this;
    }
1035978
public function with($value): ValidableInterface
    {
        parent::with($value);
        
        if (false === ($value instanceof EntityInterface)) {
            throw new ValidatorException(sprintf('Validator accept only (%s) objects', EntityInterface::class));
        }
        
        return $this;
    }
588690
public function validate($value)
    {
        $this->pushResult();
        if ($this->acceptsEmptyValues === false || $this->isEmpty($value) === false) {
            $this->isValid($value);
        }
        return $this->popResult();
    }
203915
public function setUserValue(string $value) : self
    {
        $this->user_value = $value;
        $this->is_valid = null;
        return $this;
    }
48835
public function validate (& $value, $name = '', $arguments = array())
		{
			$callbackArguments = array_merge(array(& $value), $arguments);

			$returnValue = call_user_func_array($this->callback, $callbackArguments);

			if ($returnValue) {
				return true;
			} else {
				throw new ValidationException($this->getMessage($name));
			}
		}
582838
protected function validate($value)
    {
        $parsedValue = $this->parsevalue($value);
        if ($parsedValue === false) {
            $this->messenger->add(new StringType('Value cannot be mapped'));
        }

        $ret = $this->rValidate($parsedValue, $this->typeMap, $value);
        if (!$ret) {
            $this->messenger->add(new StringType('Value has invalid type map'));
        }

        return $ret;
    }
492192
public function validateValue($value) {
        $validationResultSet = new ValidationResultSet();
        foreach($this->validators as $validator) {
            $validationResultSet->add($validator->validate($value));
        }
        return $validationResultSet;
    }
189370
public function validate($value)
    {
        if (!(is_array($value) || $value instanceof \stdClass)) {
            return false;
        }

        return $this->executePropertiesValidation($this->convertToArray($value));
    }
923499
public function validate($value) {
        if(mb_strlen($value) > $this->max) {
            return new ValidationResult(false, sprintf('Value has to have a maximum of %d characters', $this->max));
        }        
        return new ValidationResult(true);
    }
174941
public function validate($value)
    {
        $validator = new Validator();
        $jsonSchema = $this->json;

        $validator->check($value, $jsonSchema);

        if (!$validator->isValid()) {
            foreach ($validator->getErrors() as $error) {
                $this->errors[] = new TypeValidationError($error['property'], $error['constraint']);
            }
        }
    }
813330
public function runValidators($value)
    {
        if (empty($value)) {
            return;
        }

        // collect all validation errors for this field
        $validationErrors = [];
        foreach ($this->getFieldValidators() as $validator) {
            try {
                $validator($value);
            } catch (ValidationError $error) {
                $validationErrors = array_merge($validationErrors, $error->getErrorList());
            }
        }

        if (!empty($validationErrors)) {
            throw new ValidationError($validationErrors);
        }
    }
512222
public function expression($value) : self
    {
        $this->requiresCurrentField(__METHOD__);
        $this->expr[$this->currentField] = $this->ensureArray($value);

        return $this;
    }