Validate value
@see \Phramework\Validate\ValidateResult for ValidateResult object
@param  mixed $value Value to validate
@return ValidateResult
@uses $requiredCountOfAnyOf
@uses $anyOfProperty
181773
public function validate($value)
    {
        $return = new ValidateResult($value, false);
        //validator ->
        //return    ->
        $successValidated = [];

        foreach ($this->{$this->anyOfProperty} as $validator) {
            $validatorReturn = $validator->validate($value);

            if ($validatorReturn->status) {
                //push to successValidated list
                $successValidated[] = (object)[
                    'validator' => $validator,
                    'return'    => $validatorReturn
                ];
            }
        }

        if ((
                $this->requiredCountOfAnyOf === null
                && count($successValidated) > 0
            ) || (
                $this->requiredCountOfAnyOf !== null
                && count($successValidated) === $this->requiredCountOfAnyOf
            )
        ) {
            //Use first in list
            $return = $successValidated[0]->return;
            return $this->validateCommon($value, $return);
        }

        //error
        $return->errorObject = new IncorrectParametersException([
            [
                'type' => static::getType(),
                'failure' => $this->anyOfProperty
            ]
        ]);

        unset($successValidated);

        return $return;
    }
132956
public function validateValue( $value ) : bool
   {

      if ( false === $this->hasValidator() )
      {
         return true;
      }

      return (bool) ( $this->_validator )( $value );

   }
1236315
protected function validateNumber($value)
    {
        $return = new ValidateResult($value, false);

        if (is_string($value)) {
            //Replace comma with dot
            $value = str_replace(',', '.', $value);
        }

        //Apply all rules
        if (!is_numeric($value) || filter_var($value, FILTER_VALIDATE_FLOAT) === false) {
            //error
            $return->errorObject = new IncorrectParametersException([
                [
                    'type' => static::getType(),
                    'failure' => 'type'
                ]
            ]);
        } elseif ($this->maximum !== null
            && ($value > $this->maximum
                || ($this->exclusiveMaximum === true && $value >= $this->maximum)
            )
        ) {
            //error
            $return->errorObject = new IncorrectParametersException([
                [
                    'type' => static::getType(),
                    'failure' => 'maximum'
                ]
            ]);
        } elseif ($this->minimum !== null
            && ($value < $this->minimum
                || ($this->exclusiveMinimum === true && $value <= $this->minimum)
            )
        ) {
            //error
            $return->errorObject = new IncorrectParametersException([
                [
                    'type' => static::getType(),
                    'failure' => 'minimum'
                ]
            ]);
        } elseif ($this->multipleOf !== null
            && fmod((float)$value, (float)$this->multipleOf) != 0
        ) {
            //error
            $return->errorObject = new IncorrectParametersException([
                [
                    'type' => static::getType(),
                    'failure' => 'multipleOf'
                ]
            ]);
        } else {
            $return->errorObject = null;
            //Set status to success
            $return->status = true;
            //Type cast
            $return->value  = $this->cast($value);
        }

        return $return;
    }
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;
    }
890311
public function validate($value) {
        if(filter_var($value, FILTER_VALIDATE_INT)===false) {
            return new ValidationResult(false, 'Not a valid integer');
        }        
        return new ValidationResult(true);
    }
873849
public function validate($value) {
        if(!is_string($value)) {
            throw new DataType('value', 'string', $value);
        }
        
        if(!password_verify($value, $this->hash)) {
            return new ValidationResult(false, 'Wrong password');
        }        
        return new ValidationResult(true);
    }
1126306
public function validateRequired($value)
    {
        // Check for file!
        if (true === is_array($value) && true === array_key_exists('tmp_name', $value)) {
            // At least it was uploaded its valid in meaning of "required" <= NOT EMPTY
            $valid = ($value['error'] < UPLOAD_ERR_PARTIAL);
        } else {
            // Plain value ...
            $valid = (!is_null($value) && (is_array($value) || is_object($value) || (strlen($value) > 0)));
        }

        return $valid;
    }
248946
public function isValid($value)
    {
        if ( ! array_key_exists('fields', $this->getOptions())) {

            throw new \InvalidArgumentException(
                'Required option "property" not set for NoOtherObjectExists Validator.'
            );
        }

        if ( ! array_key_exists('class', $this->getOptions())) {

            throw new \InvalidArgumentException(
                'Required option "class" not set for NoOtherObjectExists Validator.'
            );
        }

        if ( ! array_key_exists('comparison_object', $this->getOptions())) {

            throw new \InvalidArgumentException(
                'Required option "comparison_object" not set for NoOtherObjectExists Validator.'
            );
        }

        if ( ! array_key_exists('identifier', $this->getOption('comparison_object'))) {

            throw new \InvalidArgumentException(
                'Required option "identifier" not set for NoOtherObjectExists Validator "comparison_object".'
            );
        }

        if ( ! array_key_exists('id', $this->getOption('comparison_object'))) {

            throw new \InvalidArgumentException(
                'Required option "id" not set for NoOtherObjectExists Validator "comparison_object".'
            );
        }

        $propertyName = $this->getOption('fields');
        $propertyClass = $this->getOption('class');

        $getterMethod = 'get' . ucfirst($propertyName);
        $cleanedValue = $this->cleanSearchValue($value);

        $comparisonObjectProperties = $this->getOption('comparison_object');
        $getIdentifier = 'get' . ucfirst($comparisonObjectProperties['identifier']);

        /** @var \object $comparisonObject */
        $comparisonObject = $this->objectRepository->findOneBy(
            [
                $comparisonObjectProperties['identifier'] => $comparisonObjectProperties['id'],
            ]
        );

        if ( ! method_exists($comparisonObject, $getterMethod)) {

            throw new \Exception(sprintf('Method %s() doesn\'t exist in class %s!', $getterMethod, $propertyClass));
        }

        $matches = $this->objectRepository->findBy($cleanedValue);
        if ($matches) {
            foreach ($matches as $index => $match) {
                // Check if the match has the same identifier as the object being edited. If it does continue, this is allowed.
                if (is_object($match)
                    && $match instanceof $propertyClass
                    && $match->$getIdentifier() === $comparisonObject->$getIdentifier()
                ) {

                    continue;
                }

                $this->error(self::ERROR_OBJECT_FOUND, $value);

                return false;
            }
        }

        return true;
    }
871467
public function setValue($value)
	{
		$failure = true;
		switch($this->opration)
		{
			case '==':
				if($value==$this->condition)
					$failure = false;
				break;
			case '>':
				if($value>$this->condition)
					$failure = false;
				break;
			case '>=':
				if($value>=$this->condition)
					$faulure = false;
				break;
			case '<':
				if($value<$this->condition)
					$failure = false;
				break;
			case '<=':
				if($value<=$this->condition)
					$failure = false;
				break;
			case '*':
				if(strpos($value, $this->condition)!==false)
					$failure = false;
				break;
			case '^':
				if(strpos($value, $this->condition)===0)
					$failure = false;
				break;
			case '$':
				if(strrpos($value, $this->condition)==strlen($value)-strlen($this->condition))
					$failure = false;
				break;
			default:
				break;
		}
		if($failure)
			throw $this->getContext()->getModel('ValidationException', 'Form', array(
				array(
					'' => 'condition failed'
				)
			));
		return $value;
	}
302997
protected function validate(&$value)
    {
        if ($this->str($value)->contains(',')) {
            $value = $this->str($value)->replace(',', '.')->val();
        }
        $value = floatval($value);

        if (!$this->isNumber($value)) {
            $this->expected('number', gettype($value));
        }

        parent::validate($value);

        return $this;
    }
718177
public function validate($value)
    {
        return is_int($value) ? Ok::unit() : Error::unit([ Error::NON_INT ]);
    }
1011805
protected function validateValue($property, $value)
    {
        $this->isPropertyValid($property);

        $regEx = '/^' . self::CONFIRMATION_PROPERTIES[$property] . '$/';

        if (preg_match($regEx, $value) != 1) {
            throw new InvalidArgumentException("The value " . $value . " for the property " . $property . ", is invalid");
        }

        return $value;
    }
228999
public function validateValue($value) {

        $model = &$this->_model;

        $attribute = $this->_attributeName;
        if ((!is_array($model->$attribute) || !count($model->$attribute)) && $this->skipOnEmpty) {
            return '';
        }

        $result = count($model->$attribute) > 0;
        $class = $this->baseModel;

        foreach ($model->$attribute as $_key => &$_model) {
            /** @var $_model Model|ActiveRecord */
            if (!is_object($_model)) {
                if (!is_array($_model)) {
                    $_model = [$this->attribute ? : $this->_attributeName => $_model];
                }
                $_model = new $class($_model);
            }

            $result = $_model->validate() && $result;
        }

        return $result || (sizeof($model->$attribute)==1 && $this->skipOnEmpty) ? null : [$this->message, $result];
    }
147515
public function validate($value)
    {
        return is_bool($value) ? Ok::unit() : Error::unit([ Error::NON_BOOL ]);
    }
1264848
public function validate($value) {
        $isDate = (new Date($this->format))->validate($value);
    
        if($isDate->isError()) {
            return $isDate;
        }
        
        if(\DateTime::createFromFormat($this->format, $value)>$this->max) {
            return new ValidationResult(false, 'Date is too late');
        }

        return new ValidationResult(true);
    }
336942
public function validate($value)
    {
        $result = parent::validate($value);
        return null === $result
            ? new EmailAddressValidationError($this)
            : $result;
    }
53632
protected function validateRequired( $value )
	{
		if( is_string( $value )) {
			$value = trim( $value );
		}
		return is_null( $value ) || empty( $value )
			? false
			: true;
	}