Sets a multiple rules for the validation.

@param  array $rules Array rules.
@return $this
15980
public function add_rules( array $rules ) {
		foreach ( $rules as $name => $rule ) {
			$this->add_rule( $name, $rule );
		}

		return $this;
	}
1296184
public  function addRules($rules) {
        if ( is_array($rules) && !empty($rules) )
		    self::$tempRules = array_merge(self::$tempRules, $rules);
	}
614763
public function withRules(array $rules): self
    {
        $new = clone $this;
        /* Clear the stack */
        unset($new->rules);
        $new->rules = new \SplStack;
        /* Add the rules */
        foreach ($rules as $callable) {
            $new = $new->addRule($callable);
        }
        return $new;
    }
827692
public function parse($rules): Rule\Set
    {
        $isArray = is_array($rules);
        $isAssoc = $isArray && self::isAssociative($rules);
        $set = null;
        if (is_string($rules) || is_object($rules) || $isAssoc) {
            $set = $this->getRule($rules);
        } elseif ($isArray) {
            foreach ($rules as $v) {
                $toAdd = $this->getRule($v);
                $set = $set === null ? $toAdd : $set->merge($toAdd);
            }
        }
        return $set ?? new Rule\Set();
    }
190300
private function setToOneIndexes(array $rules): self
    {
        assert($this->debugCheckIndexesExist($rules));

        $this->toOneRules = $rules;

        return $this;
    }
226440
public function validate(array $inputs, array $rules)
    {
        $this->inputs = $inputs;

        foreach ($rules as $key => $rule) {
            /**
             * Formatting and validation of each rule
             * eg. name => "required|max:100|alpha"
             */
            foreach (explode("|", $rule) as $masque) {
                // In the box there is a | superflux.
                if (is_int($masque) || Str::len($masque) == "") {
                    continue;
                }

                // Error lists.
                $this->errors[$key] = [];

                // Mask on the required rule
                foreach ($this->compiles as $compile) {
                    $this->{'compile'.$compile}($key, $masque);
                }

                // We clean the list of errors if the key is valid
                if (empty($this->errors[$key])) {
                    unset($this->errors[$key]);
                }
            }
        }

        return new Validate(
            $this->fails,
            $this->last_message,
            $this->errors
        );
    }
387273
public function setRules(array $rules): self
    {
        assert(empty($rules) === false);

        $this->rules = $rules;

        return $this;
    }
876945
protected function extractCustomValidationRules(array $rules)
    {
        $customRules = array_filter($rules, function ($rule) {
            return $this->isCustomRule($rule);
        });

        return $customRules;
    }
692772
protected function validate(array $data, array $rules)
    {
        $validator = $this->validator->make($data, $rules);
        if ($validator->fails()) {
            throw new ValidationException($validator);
        }
        return $this;
    }
896345
public function setRules(array $rules)
    {
        $this->initialRules = $rules;

        $this->rules = [];

        $this->addRules($rules);

        return $this;
    }
986961
protected function setRules( array $rules )
	{
		foreach( $rules as $key => $rule ) {
			$rules[ $key ] = is_string( $rule ) ? explode( '|', $rule ) : $rule;
		}

		$this->rules = $rules;

		return $this;
	}
76397
protected function makeValidator($rules = [])
    {
        // Get the casted model attributes.
        $attributes = $this->getModelAttributes();

        if ($this->getInjectUniqueIdentifier()) {
            $rules = $this->injectUniqueIdentifierToRules($rules);
        }

        $messages = $this->getValidationMessages();

        $validator = $this->getValidator()->make($attributes, $rules, $messages);

        if ($this->getValidationAttributeNames()) {
            $validator->setAttributeNames($this->getValidationAttributeNames());
        }

        return $validator;
    }
1330599
public function setRules(array $rules) {
        /* Clear the stack */
        unset($this->rules);
        $this->rules = new \SplStack;

        /* Add the rules */
        foreach ($rules as $callable) {
            $this->addRule($callable);
        }

        return $this;
    }
1167171
protected function getValidationRulesFromElements(array $rules = [])
    {
        $this->getElements()->onlyActive()->each(function ($element) use (&$rules) {
            $element = $this->getElementContainer($element);

            if ($element instanceof Validable) {
                $rules += $element->getValidationRules();
            }
        });

        return $rules;
    }
669067
private function setRule($rules)
    {
        $this->rules = array_merge_recursive(
            $this->rules, $this->explodeExplicitRule($rules)->rules
        );
    }
232873
public function setActions($actions) {
        if (!is_array($actions)) {
            $actions = array($actions);
        }
        $this->actions = array_filter($actions, array($this, 'isValidAction'));
        return $this;
    }
666752
private function setupRules($rules)
    {
        // prepares filter for requiredIf
        $rules = Utils\HelperRequiredIf::prepare($this, $rules);

        // prepares filter for sameWith.
        $rules = Utils\HelperSameWith::prepare($this, $rules);

        return $rules;
    }