Adds multiple rules to Slugify.

@param array <string,string> $rules

@return Slugify
513981
public function addRules(array $rules)
    {
        foreach ($rules as $character => $replacement) {
            $this->addRule($character, $replacement);
        }

        return $this;
    }
604898
public function make(array $data, array $rules)
    {
        $sanitizer = new Sanitizer($data, $rules, $this->customFilters);
        return $sanitizer;
    }
376758
protected function getRelevantStyleRules(array $rules)
    {
        $styleRules = [];

        foreach ($rules as $rule) {
            if ($rule instanceof StyleRuleSet) {
                $styleRules[] = $rule;
            } else if ($rule instanceof MediaRule) {
                foreach ($rule->getQueries() as $mediaQuery) {
                    // Only add styles in media rules, if the media rule is valid for "all" and "screen" media types
                    // @note: http://premailer.dialect.ca/ also supports "handheld", but this is really useless
                    $type = $mediaQuery->getType();
                    if ($type === MediaQuery::TYPE_ALL || $type === MediaQuery::TYPE_SCREEN) {
                        // ...and only if there are no additional conditions (like screen width etc.)
                        // which are dynamic and therefore need to be ignored.
                        $conditionCount = count($mediaQuery->getConditions());
                        if ($conditionCount === 0) {
                            foreach ($this->getRelevantStyleRules($rule->getRules()) as $styleRule) {
                                $styleRules[] = $styleRule;
                            }
                            break;
                        }
                    }
                }
            }
        }

        return $styleRules;
    }
981917
public function setRules(array $rules)
    {
        $this->rules = [];
        foreach ($rules as $key => $value) {
            if (is_int($key)) {
                $routeRegex  = $value;
                $permissions = [];
            } else {
                $routeRegex  = $key;
                $permissions = (array) $value;
            }
            $this->rules[$routeRegex] = $permissions;
        }
    }
1024802
public function addRules($rules)
    {
        // The primary purpose of this parser is to expand any "*" rules to the all
        // of the explicit rules needed for the given data. For example the rule
        // names.* would get expanded to names.0, names.1, etc. for this data.
        $response = (new ValidationRuleParser($this->data))
                            ->explode($rules);

        $this->rules = array_merge_recursive(
            $this->rules, $response->rules
        );

        $this->implicitAttributes = array_merge(
            $this->implicitAttributes, $response->implicitAttributes
        );
    }
96051
public function mergeRules(array $rules)
    {
        $this->extendedRules = array_merge($this->extendedRules, $rules);
        $this->parsedRules = null;
        return $this;
    }
1296184
public  function addRules($rules) {
        if ( is_array($rules) && !empty($rules) )
		    self::$tempRules = array_merge(self::$tempRules, $rules);
	}
890574
public function explode( $rules ) {
		if ( empty( $rules ) ) {
			return [];
		}

		foreach ( $rules as $key => $_rules ) {
			$rules[ $key ] = $this->parse( $_rules );
		}

		return $rules;
	}
387273
public function setRules(array $rules): self
    {
        assert(empty($rules) === false);

        $this->rules = $rules;

        return $this;
    }
760914
private static function prepareRules(array $rules)
    {
        $mergedRules = [];

        foreach ($rules as $ruleFields => $ruleConditions) {

            //if set of fields like 'firstname, lastname...'
            if (strpos($ruleFields, ',') !== false) {
                foreach (explode(',', $ruleFields) as $fieldName) {
                    $fieldName = trim($fieldName);

                    if (!isset($mergedRules[$fieldName])) {
                        $mergedRules[$fieldName] = $ruleConditions;
                    } else {
                        $mergedRules[$fieldName] .= '|'.$ruleConditions;
                    }
                }
            } else {
                if (!isset($mergedRules[$ruleFields])) {
                    $mergedRules[$ruleFields] = $ruleConditions;
                } else {
                    $mergedRules[$ruleFields] .= '|'.$ruleConditions;
                }
            }
        }

        $finalRules = [];

        //remove duplicated rules, like 'required|alpha|required'
        foreach ($mergedRules as $newRule => $rule) {
            $finalRules[$newRule] = implode('|', array_unique(explode('|', $rule)));
        }

        return $finalRules;
    }
892149
public function setRules(array $rules)
    {
        $this->validators = [];
        foreach ($rules as $rule) {
            if (is_array($rule[0]) && is_string($rule[1])) {
                continue;
            }
            throw new InvalidArgumentException('Bad validation rule');
        }
        $this->rules = $rules;

        return $this;
    }
442841
public function setPictureUploadRules($rules)
    {
        $this->_pictureUploadRules = [];
        if (!is_array($rules)) {
            return;
        }
        foreach ($rules as $rule) {
            $this->_pictureUploadRules[] = array_merge(['picture'], $rule);
        }
    }
1142649
public function addMultiple($rules)
    {
        foreach ($rules as $singleRule) {
            // make sure the rule is an array (the parameters of subsequent calls);
            $singleRule = is_array($singleRule) ? $singleRule : array(
                $singleRule
            );
            call_user_func_array(
                array(
                    $this,
                    'add'
                ),
                $singleRule
            );
        }

        return $this;
    }
126646
public static function parse_css_rules( array $rules ) {

		ob_start();

		foreach ( $rules as $rule => $properties ) {

			printf(
				"%s {\n",
				implode( ",\n", array_map( 'trim', explode( ',', $rule ) ) )
			);

			foreach ( $properties as $property => $value ) {

				printf( "\t%s: %s;\n", $property, $value );

			}

			echo "}\n";

		}

		return ob_get_clean();

	}
52583
public function set(array $rules)
    {
        $this->items = array_merge(
            $this->items,
            $this->parseRules($rules)
        );

        return $this;
    }
402019
public function make($input, $rules = [])
    {
        $this->_input = $input;
        foreach ($rules as $key => $value) {
            $this->validateInput($input, $rules, $key);
        }

        return $this;
    }
1250357
protected function getRulesAsArray($rules) {
        $rulesArray = (is_string($rules)) ? explode('|', $rules) : $rules;

        return array_map(function($rule) {
            if ($rule instanceof \Closure) {
                return $rule($this->field->getNameKey());
            }

            return $rule;
        }, $rulesArray);
    }