public function getRule($rule, $arg = null): Rule\Set
    {
        $rules = new Rule\Set();
        if (is_string($rule)) {
            $vrule = $this->registry->factory($rule, $arg);
            if ($vrule instanceof Draft) {
                $vrule = $vrule->finish($this->registry);
            }
            $rules->add($vrule);
        } elseif (is_object($rule) || is_array($rule)) {
            foreach ($rule as $name => $args) {
                $rules->merge($this->getRule($name, $args));
            }
        }
        return $rules;
    }
public function getRule($rule, $arg = null): Rule\Set
    {
        $rules = new Rule\Set();
        if (is_string($rule)) {
            $vrule = $this->registry->factory($rule, $arg);
            if ($vrule instanceof Draft) {
                $vrule = $vrule->finish($this->registry);
            }
            $rules->add($vrule);
        } elseif (is_object($rule) || is_array($rule)) {
            foreach ($rule as $name => $args) {
                $rules->merge($this->getRule($name, $args));
            }
        }
        return $rules;
    }
public function getRule ( $ rule , $ arg = null ) : Rule \ Set { $ rules = new Rule \ Set ( ) ; if ( is_string ( $ rule ) ) { $ vrule = $ this -> registry -> factory ( $ rule , $ arg ) ; if ( $ vrule instanceof Draft ) { $ vrule = $ vrule -> finish ( $ this -> registry ) ; } $ rules -> add ( $ vrule ) ; } elseif ( is_object ( $ rule ) || is_array ( $ rule ) ) { foreach ( $ rule as $ name => $ args ) { $ rules -> merge ( $ this -> getRule ( $ name , $ args ) ) ; } } return $ rules ; }
Parses rule definitions.

@param string|object|array $rule Either a string name, an associative
array, or an object with name → arguments
@param mixed $arg Optional constructor argument, or an array of arguments
@return \Caridea\Validate\Rule\Set An set of instantiated rules
Parses rule definitions .