Parser/Rules.php
public function add($type, Rule $rule)
    {
        if (!isset($this[$type])) {
            $this[$type] = [];
        }

        if ($rule->language === false) {
            $rule->language = $this->_language;
        }

        if ($rule->validator === false) {
            $rule->validator = $this->validator;
        }

        $rule->factory->setBase($type);

        if ($rule->name !== null) {
            if (isset($this[$type][$rule->name])) {
                throw new NameConflictException("Rule with '{$rule->name}' is already defined, name has to be unique!");
            }

            $this[$type][$rule->name] = $rule;
            return;
        }

        $this[$type][] = $rule;
    }
public function add($type, Rule $rule)
    {
        if (!isset($this[$type])) {
            $this[$type] = [];
        }

        if ($rule->language === false) {
            $rule->language = $this->_language;
        }

        if ($rule->validator === false) {
            $rule->validator = $this->validator;
        }

        $rule->factory->setBase($type);

        if ($rule->name !== null) {
            if (isset($this[$type][$rule->name])) {
                throw new NameConflictException("Rule with '{$rule->name}' is already defined, name has to be unique!");
            }

            $this[$type][$rule->name] = $rule;
            return;
        }

        $this[$type][] = $rule;
    }
public function add ( $ type , Rule $ rule ) { if ( ! isset ( $ this [ $ type ] ) ) { $ this [ $ type ] = [ ] ; } if ( $ rule -> language === false ) { $ rule -> language = $ this -> _language ; } if ( $ rule -> validator === false ) { $ rule -> validator = $ this -> validator ; } $ rule -> factory -> setBase ( $ type ) ; if ( $ rule -> name !== null ) { if ( isset ( $ this [ $ type ] [ $ rule -> name ] ) ) { throw new NameConflictException ( "Rule with '{$rule->name}' is already defined, name has to be unique!" ) ; } $ this [ $ type ] [ $ rule -> name ] = $ rule ; return ; } $ this [ $ type ] [ ] = $ rule ; }
Adds one rule

@param string $type
@param Rule   $rule

@throws NameConflictException When there is already defined rule with given name.
Adds one rule