Check required values.

@param array $required The required values to check.
@param array $values
@return bool
188790
public function check(array $required, array $values)
	{
		foreach ($required as $key)
		{
			if (!array_key_exists($key, $values))
			{
				return false;
			}
		}

		return true;
	}
339033
private function isValueValid(array $values): bool
    {
        foreach ($values as $value) {
            if (\preg_match("/[^\t\r\n\x20-\x7e\x80-\xfe]|\r\n/", $value)) {
                return false;
            }
        }

        return true;
    }
713183
public function allowedValues(array $choices): Validator
    {
        return $this->assertCallback(
            function ($value) use ($choices) {
                return in_array($value, $choices);
            },
            'is not an allowed value'
        );
    }
347533
public function in(array $values): bool
    {
        foreach ($values as $value) {
            if ($this->is($value)) {
                return true;
            }
        }

        return false;
    }
784868
private function checkRequiredParams(array $params, array $required) {
        foreach ($required as $param) {
            if (!isset($params[$param])) {
                throw new TransformationException('Missing required parameter: ' . $param, 400);
            }
        }
    }
1127372
public function setRequiredProperties(array $required)
    {
        if (empty($required)) {
            return $this;
        }

        if (isset($required[0]) && $required[0] === '*') {
            $this->required = get_object_vars($this);
            $this->allRequired = true;
        } else {
            $this->required = $required;
        }

        unset($this->required['required'],
              $this->required['requiredTypes'],
              $this->required['ignored'],
              $this->required['requiredParsed'],
              $this->required['allRequired']);

        return $this;
    }
1269589
protected function isRequiredIf($value, $parameters)
    {
        $this->requireParameterCount(2, $parameters, 'required_if');

        $other = Arr::get($this->data, $parameters[0]);

        $values = array_slice($parameters, 1);

        if (is_bool($other)) {
            $values = $this->convertValuesToBoolean($values);
        }

        if (in_array($other, $values)) {
            return $this->isRequired($value);
        }

        return true;
    }
677379
public function setRequired($required)
    {
        if (is_bool($required) === true) {
            $this->required = $required;
        } else {
            $msg = "The 'required' argument must be a boolean value, '" . gettype($required) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
1371538
public function required($required = null) {

		if(false === is_bool($required) && null !== $required) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type boolean, "%s" given', __METHOD__, gettype($required)), E_USER_ERROR);
		}

		if(null === $required) {
			$required = true;
		}

		foreach($this -> getFieldnames() as $field) {
			$this -> required[$field] = $required;
		}

		return $this;
	}
972148
public function date(array $values)
    {
        if (count($values) != 1) {
            $vars = array('@field' => $this->translation->text('Condition'));
            return $this->translation->text('@field has invalid value', $vars);
        }

        $timestamp = strtotime(reset($values));

        if (empty($timestamp)) {
            $vars = array('@field' => $this->translation->text('Condition'));
            return $this->translation->text('@field has invalid value', $vars);
        }

        return true;
    }
575968
public function validate(array $values, array $rules)
    {
        // Assume no validation and result success
        $result = true;

        if (true !== $valid = $this->validateByRules($rules, $values)) {
            foreach ($valid as $componentName => $error) {
                $this->setError($error, $componentName);
            }

            // Set general form error
            $this->setError(
                [
                    'error' => 'general',
                    'info'  => [],
                ],
                Doozr_Form_Service_Constant::ERROR_IDENTIFIER_FORM
            );

            $result = false;
        }

        return $result;
    }
135094
public function isValid($vals)
    {
        $fields = $this->getFields();
        if (!Arr::iterable($fields)) {
            return true;
        }

        $result = true;

        // validate each field
        foreach ($fields as $k => $field) {
            // check if required
            if ($this->isRequired($field)) {
                if (!array_key_exists($k, $vals)
                        || is_null($vals[$k])
                        || $vals[$k] === ''
                        || $vals[$k] === false
                        || ($field['type'] === 'checkbox' && empty($vals[$k]))
                    ) {
                    $result = false;
                    $this->_messages[$k] = $this->getFieldRequiredMessage($k);
                    continue;
                }
            }

            // check maxlength
            if (array_key_exists('maxlength', $field)) {
                if (strlen($vals[$k]) > $field['maxlength']) {
                    $result = false;
                    $this->_messages[$k] = 'Value too long';
                    continue;
                }
            }

            // after this point, we're only checking values based on type
            if (!array_key_exists($k, $vals)) {
                continue;
            }
            if (!array_key_exists('type', $field)) {
                continue;
            }
 
            // Select
            if ($field['type'] === 'select') {
                if (!array_key_exists($vals[$k], $field['options'])) {
                    $result = false;
                    $this->_messages[$k] = 'Invalid option';
                }
                continue;
            }

            // Email
            if ($field['type'] === 'email') {
                if (!filter_var($vals[$k], FILTER_VALIDATE_EMAIL)) {
                    $result = false;
                    $this->_messages[$k] = 'Invalid email address';
                }
                continue;
            }

            // URL
            if ($field['type'] === 'url') {
                if (!filter_var($vals[$k], FILTER_VALIDATE_URL)) {
                    $result = false;
                    $this->_messages[$k] = 'Invalid URL';
                }
                continue;
            }

            // Color
            // http://www.w3.org/TR/html-markup/input.color.html#input.color.attrs.value
            if ($field['type'] === 'color') {
                if (!preg_match('/^#[0-9a-f]{6}$/i', $vals[$k])) {
                    $result = false;
                    $this->_messages[$k] = 'Invalid color';
                }
                continue;
            }
        }
        return $result;
    }
1367827
public function isValid(array $values)
    {
        foreach ($values as $value) {
            if (!$this->checkType($value)) {
                return false;
            }
        }

        return true;
    }
287925
public function check()
    {
        $currentValue = (int) ini_get($this->setting);
        
        $return = false;
        foreach($this->requiredValues as $key => $requiredValue){
            $this->requiredValues[$key]['isValid'] = version_compare($currentValue, $requiredValue['requiredValue'], $requiredValue['operator']);
            
            if($this->requiredValues[$key]['isValid']){
                $return = true;
            }
        }
        
        return $return;
    }
906319
public static function requireParameters($parameters, $required)
    {
        //Work with arrays
        if (is_object($parameters)) {
            $parameters = (array)$parameters;
        }

        $missing = [];

        if (!is_array($required)) {
            $required = [$required];
        }

        foreach ($required as $key) {
            if (!isset($parameters[$key])) {
                array_push($missing, $key);
            }
        }

        if (count($missing)) {
            throw new MissingParametersException($missing);
        }
    }
675409
final public static function hasValue (...$values) : bool
	{
		foreach ($values as $value):
			if (is_array($value)):
				if (!(isset($value) AND (!empty($value)))):
					return FALSE; break;
				endif;
			else:
				$trimmedValue = trim($value);
				if (!(isset($trimmedValue) AND ($trimmedValue !== ""))):
					return FALSE; break;
				endif;
			endif;
		endforeach;
		return TRUE;
	}
517449
protected function validateRequiredParameters(array $required, array $params)
    {
        foreach ($required as $param) {
            if (!isset($params[$param])) {
                throw new MissingArgumentException(sprintf('The "%s" parameter is required.', $param));
            }
        }
    }