Check if fields are valid
@param array $fields
@throws InvalidArgumentException
12726
private function assertValidFields($fields)
    {
        if(!isset($fields)) {
            throw new InvalidArgumentException("Fields are empty");
        }

        foreach($fields as $field) {
            if(count(explode('.', $field['key'])) != 2) {
                throw new InvalidArgumentException('Key has wrong format');
            }
        }
    }
632798
public function setFields( $fields )
	{
		if( is_array( $fields ) && count( $fields ) )
			$this->fields = $fields;
		else
			trigger_error( 'Field Array of Table Definition must no be empty.', E_USER_ERROR );
	}
1264564
public function validateScalarArray($array)
    {
        if (!is_array($array)) {
            throw new \InvalidArgumentException(sprintf(
                'Expected array value, got: %s',
                var_export($array, true)
            ));
        }

        foreach ($array as $key => $value) {
            if (false == is_scalar($value)) {
                throw new \InvalidArgumentException(sprintf(
                    'Cannot use an array as a value in a multivalue property. Value was: %s',
                    var_export($array, true)
                ));
            }
        }
    }
132948
public static function validateArray(array $array) {
        $reflection =  new ReflectionClass(get_called_class());
        $allowedValues = $reflection->getConstants();
        foreach($array as $element) {
            if (!in_array($element, $allowedValues)) {
                throw new InvalidArgumentException(sprintf(
                    '%s is not a valid %s',
                    $element,
                    get_called_class()
                ));
            }
        }
    }
113602
public function fields($fields) {
        if (!is_array($fields)) {
            $fields = func_get_args();
        }

        $this->_fields = $fields;

        return $this;
    }
1098839
public function delFieldsArray(array $fields)
	{
	        foreach ($fields as $field) {
                        $this->_redis->hdel($this->_key, $field);
                }
	}
175887
protected function setQueryFields(array $fields)
    {
        $this->queryFields = array();
        foreach ($fields as $field => $included) {
            if ($included) $this->queryFields[$field] = 1;
        }
    }
5564
public function hasFields(array $fields)
    {
        try {
            $this->model_class::checkUnknownColumn($fields);
        } catch (UnknownColumnException $e) {
            return "Resource '$this->name' "
                . explode(' ', $e->getMessage(), 2)[1];
        }
        return true;
    }
778262
protected function validateRecipients(array $recipients)
    {
        if (true == empty($recipients)) {
            throw new \InvalidArgumentException('Recipients list should not be empty');
        }

        foreach ($recipients as $recipient) {
            if (true == is_string($recipient) && $this->isValidMail($recipient)) {
                continue;
            }

            throw new \InvalidArgumentException(sprintf(
                'Given recipients list %s has invalid recipient %s',
                var_export($recipients, true),
                var_export($recipient, true)
            ));
        }
    }
18677
protected function validateOptions(array $options)
    {
        foreach ($options as $option => $value) {
            if (!array_key_exists($option, $this->defaultOptions)) {
                throw new \InvalidArgumentException(sprintf('Unrecognized option "%s".', $option));
            }
        }
        if (isset($options['html']) && !is_bool($options['html'])) {
            throw new \InvalidArgumentException('The option "html" must be a boolean.');
        }
        if (isset($options['html_attributes']) && !is_array($options['html_attributes'])) {
            throw new \InvalidArgumentException('The option "html_attributes" must be an array.');
        }
    }
569866
public function validateHeader(array $header)
    {
        if (!isset($header['alg'])) {
            throw new \InvalidArgumentException("Missing 'alg' in header");
        }
        if (!isset($header['typ'])) {
            throw new \InvalidArgumentException("Missing 'typ' in header");
        }
        if ($this->type !== $header['alg']) {
            throw new \InvalidArgumentException("Algorithm mismatch");
        }
    }
927183
public function validateAsRequiredFields(array $fields) {
		foreach ($fields as $v) {
			$options = $this->fields[$v];
			$options['options']['required'] = true;
			$this->validateRequiredOneField($this->values[$v], $v, $options);
		}
	}
76926
protected function setFields($fields) 
    {
    	foreach ($fields as $name => $value) {
            $property = '_' . $name;
            if (property_exists($this, $property)) $this->$property = $value;
        }
    }
729397
protected static function validateHeaderValue(array $values){
        static $validCache = [];

        foreach($values as $index => $value){
            if(!is_string($value)){
                throw new \InvalidArgumentException(
                    "Header value must be of the type string array, "
                    . gettype($value)
                    . " given at index of {$index}."
                );
            }

            if(!isset($validCache[$value])){
                if(1 !== preg_match(static::REGEX_HEADER_VALUE, $value)){
                    throw new \InvalidArgumentException(
                        "Invalid Header value given at index of {$index}."
                    );
                }
            }

            $validCache[$value]  = true;
        }
    }
1130000
public final function verifyOnly($fields){

        foreach($fields as $k){
            $this->verifyData($k);
        }//foreach

        if(count($this->errors)){
            return false;
        }//if

        return true;

    }
830546
public function fields(array $fields = null)
    {
        if ($fields === null) {
            return $this->container;
        }

        $output = [];

        foreach ($fields as $name) {
            if (isset($this->container[$name]) || array_key_exists($name, $this->container)) {
                $output[$name] = $this->container[$name];
            } else {
                throw new \InvalidArgumentException(
                    sprintf(
                        "No such field '%s'. Existing fields are {%s}",
                        $name,
                        join(', ', array_keys($this->container))
                    )
                );
            }
        }

        return $output;
    }
1058681
public function setFromArray(array $fields)
    {
        foreach($fields as $key => $value)
        {
                $this->fields[$key] = $value;
                unset($key);
                unset($value);
        }
    }