Add the constraints as rules

@param XType $type
@param array $rule
512721
protected function addConstraints(XType $type, &$rule)
    {

        foreach ($type->constraints as $name=>$parameters) {

            if ($name == 'not_null') {
                continue;
            }

            if (isset($this->constraintToRule[$name])) {
                $constraintName = $this->constraintToRule[$name];
                $rule[] = $constraintName . ':' . implode($parameters);
            }

        }
    }
1247451
public function addLexerRule($rulename, $rule)
	{
		$this->rules[$rulename] = [];
		$this->rules[$rulename][] = $rule; 
	}
832542
public function withRule(Rule $rule): RulesCollection
    {
        $rules = array_merge($this->rules, [$rule]);

        return new RulesCollection($rules);
    }
909238
public function _setType(string $type, array $relation)
    {
        $this->type = $type;
        $this->relation = $relation;
        return $this;
    }
177879
public function addDependentExtension($rule, $extension)
    {
        $this->addExtension($rule, $extension);

        $this->dependentRules[] = Str::studly($rule);
    }
895570
public function in($rule) {
        $this->check_role = 'in';
        if (!is_array($rule)) {
            $rule = explode(',', $rule);
        }
        $this->rule = '[' . explode(',', $rule) . ']';
        $result = in_array($this->value, $rule);
        $this->checkResult($result);
        return $this;
    }
1082439
static function addRule(\CharlotteDunois\Validation\RuleInterface $rule) {
        if(static::$rulesets === null) {
            static::initRules();
        }
        
        $class = \get_class($rule);
        $arrname = \explode('\\', $class);
        $name = \array_pop($arrname);
        
        $rname = \str_replace('rule', '', \strtolower($name));
        static::$rulesets[$rname] = $rule;
        
        if(\stripos($name, 'rule') !== false) {
            static::$typeRules[] = $rname;
        }
    }
1126575
protected function addGroupName(XType $type, &$rule)
    {
        $groupName = $this->groupName($type);

        if (isset($this->typeToRule[$groupName])) {
            $rule[] = $this->typeToRule[$groupName];
        }
    }
644850
public function supportsConstraint($type, array $options = [])
    {
        if (in_array($type, $this->types)) {
            $this->type = $type;
            return true;
        }

        return false;
    }
1266318
public static function manipulation(Array $rules, String $type = 'none') : String
    {
        $query = NULL;

        foreach( $rules as $key => $value )
        {
            if( is_numeric($key) )
            {
                if( ! empty($val = self::get($value)) )
                {
                    $query .= $value . '/' . $val . '/';
                }
            }
            else
            {
                $query .= $key . '/' . $value . '/';
            }
        }

        return self::_addFix($query, $type);
    }
692859
public function mapFieldsRules(array $rules)
    {
        foreach ($rules as $field => $rule) {
            $this->mapFieldRules($field, $rule);
        }
    }
219405
public function rule($name, $rule='')
    {
        if (is_array($name)) {
            $this->rule=array_merge($this->rule, $name);
        } else {
            $this->rule[$name]=$rule;
        }
        return $this;
    }
778809
public function addRules($rules)
    {
        foreach ($rules as $rule) {
            $this->addrule($rule[0], $rule[1], $rule[2], isset($rule[3])?$rule[3]:null);
        }
    }
1274152
public function addRules(array $rules) : ValidatorInterface
    {
        if (!is_array($rules) || empty($rules)) {
            throw new ValidatorException(sprintf('Validator::addRules() expect array of rules, %s given.', \gettype($rules)));
        }

        foreach ($rules as $field => $rule) {
            $this->addRule($field, $rule);
        }

        return $this;
    }
984147
public function setRule($rule)
	{
		if(null === $rule)
		{
			$rule = Dispatch::module() . '/' . Dispatch::control() . '/' . Dispatch::action();
		}
		$this->rule = $rule;
	}
513981
public function addRules(array $rules)
    {
        foreach ($rules as $character => $replacement) {
            $this->addRule($character, $replacement);
        }

        return $this;
    }
637065
public function addConstraint(Constraint $constraint) : void
    {
        $constraint->setValidator($this);
        array_push($this->constraints, $constraint);
    }