public function addRules($rules)
    {
        if ($rules instanceof RiskyRulesAwareInterface && $rules->isRisky()) {
            $this->setRiskyAllowed(true);
        }

        if ($rules instanceof \Traversable) {
            $rules = iterator_to_array($rules);
        }

        if (!is_array($rules)) {
            throw new \InvalidArgumentException('Expected rules to be an iterable.');
        }

        $rules = array_replace($this->getRules(), $rules);

        $this->setRules($rules);

        return $this;
    }
public function addRules($rules)
    {
        if ($rules instanceof RiskyRulesAwareInterface && $rules->isRisky()) {
            $this->setRiskyAllowed(true);
        }

        if ($rules instanceof \Traversable) {
            $rules = iterator_to_array($rules);
        }

        if (!is_array($rules)) {
            throw new \InvalidArgumentException('Expected rules to be an iterable.');
        }

        $rules = array_replace($this->getRules(), $rules);

        $this->setRules($rules);

        return $this;
    }
public function addRules ( $ rules ) { if ( $ rules instanceof RiskyRulesAwareInterface && $ rules -> isRisky ( ) ) { $ this -> setRiskyAllowed ( true ) ; } if ( $ rules instanceof \ Traversable ) { $ rules = iterator_to_array ( $ rules ) ; } if ( ! is_array ( $ rules ) ) { throw new \ InvalidArgumentException ( 'Expected rules to be an iterable.' ) ; } $ rules = array_replace ( $ this -> getRules ( ) , $ rules ) ; $ this -> setRules ( $ rules ) ; return $ this ; }
Add to the current rules. Overrides existing rules.

See {@see setRules} for the format of these rules.

@param iterable $rules

@return $this
Add to the current rules . Overrides existing rules .