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();
    }
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();
    }
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 ( ) ; }
Turns a number of rule definitions into an actual Rule Set.

@param string|object|array $rules The rules to parse
@return \Caridea\Validate\Rule\Set The set of Rules
Turns a number of rule definitions into an actual Rule Set .