Checks whether given value is in the existing options.

@param string $optionValue
@param array  $options

@return bool
975803
public function containsOption($optionValue, $options)
    {
        if ($this->validationDisabled) {
            return true;
        }

        foreach ($options as $option) {
            if ($option['value'] == $optionValue) {
                return true;
            }
        }

        return false;
    }
1362162
protected function _checkNoSelected(array $options, array $selected, $isMultiply = false)
    {
        if ($isMultiply === 'multiple') {
            return array($options, $selected);
        }

        $_selected = array_pop($selected);

        if (!Arr::key($_selected, $options) && !empty($selected)) {
            $options = array_merge(array($_selected => $this->_translate('--No selected--')), $options);
        }

        return array($options, array($_selected));
    }
1306599
public function isValid($value = null, array $options = []): bool
    {
        if (\count($options) > 0) {
            $this->setOptions($options);
        }
        $this->setValue($value);
        $this->errors = [];

        return $this->validateDateTime();
    }
1239528
public function valid($options = array())
    {
        $options && $this->setOption($options);

        // Initialize the validation result to be true
        $this->result = true;

        $this->beforeValidate && call_user_func($this->beforeValidate, $this, $this->wei);

        foreach ($this->rules as $field => $rules) {
            $data = $this->getFieldData($field);

            /**
             * Process simple rule
             * FROM
             * 'username' => 'required'
             * TO
             * 'username' => array(
             *     'required' => true
             * )
             */
            if (is_string($rules)) {
                $rules = array($rules => true);
            } elseif ($rules instanceof BaseValidator) {
                $rules = array($rules);
            } elseif (!is_array($rules)) {
                throw new \InvalidArgumentException(sprintf(
                    'Expected argument of type array, string or instance of Wei\Validator\BaseValidator, "%s" given',
                    is_object($rules) ? get_class($rules) : gettype($rules)
                ));
            }

            // Make sure the "required" rule at first
            if (!isset($rules['required'])) {
                $isRequired = true;
            } else {
                $isRequired = (bool) $rules['required'];
                unset($rules['required']);
            }
            $rules = array('required' => $isRequired) + $rules;

            // Start validation
            foreach ($rules as $rule => $params) {
                // Prepare property options for validator
                $props = $this->prepareProps($field, $rule);

                // The current rule validation result
                /* @var $validator Validator\BaseValidator */
                $validator = null;
                $result = $this->validateOne($rule, $data, $params, $validator, $props);

                if (is_object($params)) {
                    $rule = get_class($params);
                }

                // Record the rule validators
                $this->ruleValidators[$field][$rule] = $validator;

                // If any rule is invalid, the result would always be false in the whole validation flow
                if (false === $result) {
                    $this->result = false;
                }

                // Record the valid/invalid rule
                $method = $result ? 'addValidRule' : 'addInvalidRule';
                $this->$method($field, $rule);

                // Trigger the ruleValid/ruleInvalid callback
                $callback = $result ? 'ruleValid' : 'ruleInvalid';
                if ($this->$callback && false === call_user_func($this->$callback, $rule, $field, $this, $this->wei)) {
                    return $this->result;
                }

                if ($result) {
                    // The field data is empty and optional, skip the remaining validation rules
                    /** @var $validator Validator\Required */
                    if ('required' === $rule && $validator->isInvalid($data)) {
                        break;
                    }
                } else {
                    // Break the validation flow when any field's rule is invalid
                    if ('required' === $rule || $this->breakRule || $this->skip) {
                        break;
                    }
                }
            }

            // Trigger the fieldValid/fieldInvalid callback
            $callback = $this->isFieldValid($field) ? 'fieldValid' : 'fieldInvalid';
            if ($this->$callback && false === call_user_func($this->$callback, $field, $this, $this->wei)) {
                return $this->result;
            }

            if (!$this->result && $this->skip) {
                continue;
            }

            // Break the validation flow when any field is invalid
            if (!$this->result && ($this->breakRule || $this->breakField)) {
                break;
            }
        }

        // Trigger the success/failure callback
        $callback = $this->result ? 'success' : 'failure';
        $this->$callback && call_user_func($this->$callback, $this, $this->wei);

        return $this->result;
    }
60684
public function isValid($value = null, array $options = []): bool
    {
        $this->setOptions($options);
        $this->setValue($value);
        $this->errors = [];

        $this->options['stored-passwords'] = array_reverse($this->options['stored-passwords']);

        $lengthValid = $this->validateLength();
        $letterValid = $this->validateLetter();
        $lowercaseLetterValid = $this->validateLowercaseLetter();
        $uppercaseLetterValid = $this->validateUppercaseLetter();
        $numberValid = $this->validateNumber();
        $specialCharacterValid = $this->validateSpecialCharacter();
        $differentPrevOneValid = $this->validateDifferentPreviousOne();
        $differentPrevAllValid = $this->validateDifferentPreviousAll();

        return $lengthValid
            && $letterValid
            && $lowercaseLetterValid
            && $uppercaseLetterValid
            && $numberValid
            && $specialCharacterValid
            && $differentPrevOneValid
            && $differentPrevAllValid;
    }
195586
protected function createOptionValueBag($initialValue)
    {
        $result = new OptionValueBag();
        if (null !== $initialValue) {
            $result->add($initialValue);
        }

        return $result;
    }
1298290
public function isValid($value = null, array $options = []): bool
    {
        if (\count($options) > 0) {
            $this->setOptions($options);
        }
        $this->setValue($value);
        $this->errors = [];

        $validType = $this->validateType();
        $validGT = $this->validateGreaterThan();
        $validLT = $this->validateLowerThan();

        return $validType && $validGT && $validLT;
    }
2385
public function check($value, $hashedValue, array $options = array()) {

        return strtoupper($this->make($value)) === strtoupper($hashedValue);
    }
771190
public function isValid($value = null, array $options = []): bool
    {
        if (\count($options) > 0) {
            $this->setOptions($options);
        }
        $this->setValue($value);
        $this->errors = [];

        if (\strpos($this->value, '..') !== false || !\preg_match('/^(.+)@([^@]+)$/', $this->value, $matches)) {
            $this->setError(self::VALIDATOR_ERROR_EMAIL_INCORRECT_FORMAT);
            return false;
        }
        if (!\filter_var($this->value, FILTER_VALIDATE_EMAIL) !== false) {
            $this->setError(self::VALIDATOR_ERROR_EMAIL_INCORRECT_FORMAT);
            return false;
        }
        $host = $matches[2];
        if ($this->options['domain-check'] === true && @\gethostbyname($host) === $host) {
            $this->setError(self::VALIDATOR_ERROR_EMAIL_INVALID_DOMAIN);
            return false;
        }
        if ($this->options['mx-check'] === true) {
            return $this->mxCheck($host);
        }

        return true;
    }
374082
public function isHaveValue($checkValue)
    {
        $this->checkFunctions[] = function ($value) use ($checkValue) {
            if (!is_array($value)) {
                return false;
            }
            return in_array($checkValue, $value);
        };
        return $this;
    }
1302604
public function setOptions(array $options)
    {
        if(isset($options['exchange'])){
            if(!is_string($options['exchange'])){
                throw new \UnexpectedValueException('exchange value is not a string, a string is required');
            }
            $this->exchange = $options['exchange'];
            unset($options['exchange']);
        }
        if(isset($options['queue'])){
            if(isset($options['queue']['arguments'])){
                $this->queueOptions = $options['queue'];
            }
            unset($options['queue']);
        }
        $merged = array('uri' => isset($options['connection']) ? $options['connection'] : $this->options['uri']);
        $merge['options'] = array_merge($this->options['options'], (array) @$options['options']);
        $this->options = $merged;
        return $this;
    }
676749
final public function check(array $options) {
        foreach ($options as $property => $value) {
            if ((is_array($value) && !in_array($this->$property, $value)) ||
                    (!is_array($value) && $this->$property !== $value))
                return false;
        }

        return true;
    }
772299
public function isSelectedValue($dataValue, $userValue)
    {
        if (is_array($userValue) && in_array($dataValue, $userValue)) {
            return true;
        }
        
        return parent::isSelectedValue($dataValue, $userValue);
    }
345190
private function getOptionValue($steps, array $options)
    {
        $value = $options;
        $steps = explode('.', $steps);

        foreach ($steps as $step) {
            if (!array_key_exists($step, $value)) {
                return;
            }

            $value = $value[$step];
        }

        return $value;
    }
457723
public function setOptions($options) {
    $result = true;
    foreach($options as $option => $value) {
      $result |= $this->setOption($option, $value);
    }
    return $result;
  }
752165
protected function parseFlagOption($optionString)
    {
        for ($i = 0; $i < strlen($optionString); $i++) {
            $optionChar = substr($optionString, $i, 1);
            $optionParts = explode('=', substr($optionString, $i + 1));

            if (count($optionParts) > 1 && empty($optionParts[0])) {
                $value = $optionParts[1];
            } elseif ($optionChar !== "=") {
                $value = true;
            } else {
                break;
            }

            $this->flagOptions[$optionChar] = $value;
        }
        return $this;
    }
743762
public function isValid($value = null, array $options = []): bool
    {
        if (\count($options) > 0) {
            $this->setOptions($options);
        }
        $this->setValue($value);
        $this->errors = [];

        $validIP = $this->validateIPNumber();
        $validPrivRange = $this->validatePrivateRange();
        $validResRange = $this->validateReservedRange();

        return $validIP && $validPrivRange && $validResRange;
    }